Skip to content

temptable without defaults#32

Open
IstvanSafar wants to merge 2 commits intoPawelGerr:releases/4.x.xfrom
IstvanSafar:releases/4.x.x
Open

temptable without defaults#32
IstvanSafar wants to merge 2 commits intoPawelGerr:releases/4.x.xfrom
IstvanSafar:releases/4.x.x

Conversation

@IstvanSafar
Copy link

finally I figured out how should be implemented

@PawelGerr
Copy link
Owner

Thx, I need some time to analyze the changes.

@IstvanSafar
Copy link
Author

Probably we can add excluded property list for defaults or option for skipping PK-s defaults, or both of the tree options.

@PawelGerr
Copy link
Owner

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants