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

BulkInsertOrUpdate PK column does not get auto generated #1336

Open
sokunna opened this issue Dec 1, 2023 · 1 comment
Open

BulkInsertOrUpdate PK column does not get auto generated #1336

sokunna opened this issue Dec 1, 2023 · 1 comment

Comments

@sokunna
Copy link

sokunna commented Dec 1, 2023

I'm using this method to do insert if the data does not already exist otherwise update. However the PK Id column is always inserted as an empty guid. I'm using version 7.0.4.

My primary key has these attributes set:
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]

BulkConfig bulkConfig = new BulkConfig
{
UpdateByProperties = updateByProperties,
PropertiesToExcludeOnUpdate = excludedProperties,
PropertiesToExcludeOnCompare = excludeOnCompare,
SetOutputIdentity = true,
SqlBulkCopyOptions = SqlBulkCopyOptions.KeepIdentity
};
await _dbContext.BulkInsertOrUpdateAsync(models, bulkConfig);

@Snazzie
Copy link

Snazzie commented Jul 28, 2024

did you find a solution @sokunna ?

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

No branches or pull requests

2 participants