Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temptable without defaults #32

Open
wants to merge 2 commits into
base: releases/4.x.x
Choose a base branch
from

Conversation

safigi
Copy link

@safigi safigi commented Dec 6, 2022

finally I figured out how should be implemented

@PawelGerr
Copy link
Owner

Thx, I need some time to analyze the changes.

@safigi
Copy link
Author

safigi commented Dec 11, 2022

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