Thinktecture.EntityFrameworkCore
Thinktecture.EntityFrameworkCore copied to clipboard
temptable without defaults
finally I figured out how should be implemented
Thx, I need some time to analyze the changes.
Probably we can add excluded property list for defaults or option for skipping PK-s defaults, or both of the tree options.
Yes, I would prefer more flexibel approach, similar to KeyProperties or PropertiesToUpdate:
var options = new SqlServerBulkUpdateOptions
{
KeyProperties = IEntityPropertiesProvider.Include<Customer>(c => c.Id),
PropertiesToUpdate = IEntityPropertiesProvider.Include<Customer>(c => new { c.FirstName, c.LastName }),
// new
SkipIdentityColumnDefinition = IEntityPropertiesProvider.Include<Customer>(c => c.Id),
SkipDefaultValueDefinition = IEntityPropertiesProvider.Include<Customer>(c => c.Id)
};
await ctx.BulkUpdateAsync(new[] { customer }, options);
A shortcut is possible as well
await ctx.BulkUpdateAsync(new[] { customer },
propertiesToUpdate: c => new { c.FirstName, c.LastName },
skipIdentityColumnDefinition: c => c.Id,
skipDefaultValueDefinition: c => c.Id);