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
BulkMerge/Update does not use primary key by default #536
Comments
Hello @Ta1sty , Our library should correctly use the Here is an online example with your scenario: https://dotnetfiddle.net/vPWHbR I believe we missed a piece of the puzzle that could explain this behavior. Is it possible for you to reproduce the issue by using the Fiddle we provided or by creating a runnable project? It doesn’t need to be your project, just a new solution with the minimum code to reproduce the issue. You can send it in private here: info@zzzprojects.com Best Regards, Jon |
I have reviewed your example and there are missing some things. What was missing was another entity that refernces the alternate key I believe |
@JonathanMagnan seems like .NetFiddle isnt working for me. Here is code to reproduce the issue:
|
Thank you @Ta1sty for the additional information. That will surely help us to better understand the issue. Best Regards, Jon |
Hello @Ta1sty , Just to give you an update: This is definitely a mistake on our part and something we didn't expect. However, fixing it is currently impossible as too many major changes are required. We first need to release our new So this is definitely something that we will try to fix in a few weeks. Best Regards, Jon |
Description
I have a table (Proceedings) where i want to update a value and for that i do a bulk merge/or bulkUpdate for that matter.
However when I execute the bulkMerge below it produces a query that uses the alternate key instead of defaulting to the primary key.
Here is the relevant config
The executed statement:
The produced query
If i configure the query with
The produces query works fine. What I dont get is why does it default to using the alternate key, even though I is not included in the ColumnInputExpression. If I do a BulkMerge it atleast fails because it tries to insert NULL into another column and does fail.
HOWEVER:
If BulkUpdate is used, then it never matches and fails silently, resulting in failing updates all over our codebase without producing an error.
I would like to know if this actually intended that the ColumnPrimaryKeyExpression defaults to anything else other than the configured PrimaryKey.
The same thing also happens if I use a unique index instead of an alternate key.
EF: 7.0.8
Z.EntityFramework.Extensions 7.22.3
Provider: SqlServer
The text was updated successfully, but these errors were encountered: