Closed hzahradnik closed 4 years ago
Thanks for the feedback. I'll try to have a look at this asap and also try getting the next release out. I am currently the only one in my family not dealing with the flu so I've been a bit busy taking care of wife and kids, but things are looking up now so I'm slowly getting back to normal.
Måns Tånneryd Tånneryd IT AB Barrskogsvägen 19 186 53 Vallentuna +46-705140093 https://se.linkedin.com/in/manstanneryd
https://github.com/mtanneryd/ef6-bulk-operations https://github.com/mtanneryd/ef6-bulk-operations
Den ons 18 mars 2020 kl 08:28 skrev hzahradnik notifications@github.com:
We found another problem with this library when using for our project. When a table has a store identity, the current version tries to insert this column, which of course fails as it is not allowed to insert a specific value to an identity column.
As a solution, the call to select the properties now filters a column, if IsStoreGeneratedComputed is true. To test this, I refactored the context I added in the previous PR #29 https://github.com/mtanneryd/ef6-bulk-operations/pull/29 and added a identity column. As a consequence I had to reorder the existing migrations.
Unfortunately, I added the changes onto #29 https://github.com/mtanneryd/ef6-bulk-operations/pull/29, instead of adding it onto your master. I looked into rebasing, but as I use the same context, it would be rather difficult. If you want, I can try, but for now I leave it like it is and rebase it, if you merge #29 https://github.com/mtanneryd/ef6-bulk-operations/pull/29.
If you need anything else, you can ask us for help. We are eager to help.
You can view, comment on, or merge this pull request online at:
https://github.com/mtanneryd/ef6-bulk-operations/pull/30 Commit Summary
- add test case to show issue with primary key mapped to different column name
- add test case for non existing select of model with different primary key column name
- fix for issue #23
- Refactored migrations folder, add migration to InvoiceContext
- Add test for store identity column
- fix for BulkInsertAll on table with identity column
File Changes
- A Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/DM/Invoice/Invoice.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-798e8b068eabad2745e0b8d3cb3038d8 (74)
- A Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/EF/InvoiceContext.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-bf0583c321f9d9600eb255020e4b8e8c (95)
- A Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/Invoice/202002251507218_InitialCreate.Designer.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-e09d59fbebb2400d3fecbf33bc0281df (29)
- A Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/Invoice/202002251507218_InitialCreate.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-e3fa590d16a923d2368453dcd7545985 (83)
- A Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/Invoice/202002251507218_InitialCreate.resx https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-1b82285b029a4715922b3c8ee044e97a (126)
- A Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/Invoice/202002251520286_AddComputedTaxColumnToInvoice.Designer.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-f8046c846f172e22f2e38221a11e15c9 (29)
- A Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/Invoice/202002251520286_AddComputedTaxColumnToInvoice.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-10cc70973425e36878ab16238d32b275 (17)
- A Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/Invoice/202002251520286_AddComputedTaxColumnToInvoice.resx https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-2496d466e2765be3013ed23f1ea3b249 (126)
- A Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/Invoice/Configuration.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-a6160cfb880acf9b4b97dd3956504f1b (24)
- R Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/School/201901131910265_InitialCreate.Designer.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-acb81fb22954183a72478092e622a80c (2)
- R Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/School/201901131910265_InitialCreate.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-055cc979720a913c927bf1b72910e459 (2)
- R Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/School/201901131910265_InitialCreate.resx https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-45653429a5c25f8eba694731e6551396 (0)
- R Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/School/201901131912134_AddComputedFullNameColumnToInstructor.Designer.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-6b15ab9b528e3a57706daba59a42930e (2)
- R Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/School/201901131912134_AddComputedFullNameColumnToInstructor.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-e389332344cc55facd92a87511becdbc (2)
- R Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/School/201901131912134_AddComputedFullNameColumnToInstructor.resx https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-8515196f9da7a066162e5b2135a3e44b (0)
- R Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Models/Migrations/School/Configuration.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-f4791dcec2e9ac0a81aef71b376875ec (2)
- M Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Tests/BulkOperationTestBase.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-5e0f74aa47e678096b6adf0693aed908 (20)
- A Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Tests/Insert/BulkInsertInvoice.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-6b242205c1baff85aa3f2f1217b8692d (81)
- M Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/Tests/Select/BulkSelectExistingTests.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-2b52c7e4be8777ef488cb5aceb54503e (37)
- M Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6/DbContextExtensions.cs https://github.com/mtanneryd/ef6-bulk-operations/pull/30/files#diff-537ea9f4e5c5ac15fb6e4ec9137a852a (6)
Patch Links:
- https://github.com/mtanneryd/ef6-bulk-operations/pull/30.patch
- https://github.com/mtanneryd/ef6-bulk-operations/pull/30.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mtanneryd/ef6-bulk-operations/pull/30, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2BSROYALZZGKKUOQVLAGDRIBZYBANCNFSM4LOJJH7Q .
no hurry! you are doing a great job on this library. thanks (head of hzahradnik)
Hi!
I've started working on this now. The error you got only happens when you have a computed column in a table with a user generated primary key. I already skip the computed columns when inserting into tables with database generated keys but forgot to deal with them in other tables. However, the way we avoid the computed columns today is less optimal than the way you suggested so I'll refactor the code using your suggested solution. There are some other refactorings being made also so instead of merging your changes from your branch I'll simply add them to my current development branch. I also plan to add the following to the readme file.
"Fixed a bug when using computed columns in tables without identity primary keys (reported and resolved by https://github.com/hzahradnik)"
If you prefer not to be mentioned in the README please let me know.
Måns Tånneryd Tånneryd IT AB Barrskogsvägen 19 186 53 Vallentuna +46-705140093 https://se.linkedin.com/in/manstanneryd
https://github.com/mtanneryd/ef6-bulk-operations https://github.com/mtanneryd/ef6-bulk-operations
Den ons 18 mars 2020 kl 10:30 skrev Brandinga notifications@github.com:
no hurry! you are doing a great job on this library. thanks (head of hzahradnik)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mtanneryd/ef6-bulk-operations/pull/30#issuecomment-600500450, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2BSRPLI57LUEGHUX54KVDRICEGBANCNFSM4LOJJH7Q .
Working on the fix but got into some unexpected issues with InvoiceItem table. I'll keep you posted.
/Måns
Måns Tånneryd Tånneryd IT AB Barrskogsvägen 19 186 53 Vallentuna +46-705140093 https://se.linkedin.com/in/manstanneryd
https://github.com/mtanneryd/ef6-bulk-operations https://github.com/mtanneryd/ef6-bulk-operations
Den mån 23 mars 2020 kl 09:01 skrev Måns Tånneryd mans@tanneryd.se:
Hi!
I've started working on this now. The error you got only happens when you have a computed column in a table with a user generated primary key. I already skip the computed columns when inserting into tables with database generated keys but forgot to deal with them in other tables. However, the way we avoid the computed columns today is less optimal than the way you suggested so I'll refactor the code using your suggested solution. There are some other refactorings being made also so instead of merging your changes from your branch I'll simply add them to my current development branch. I also plan to add the following to the readme file.
"Fixed a bug when using computed columns in tables without identity primary keys (reported and resolved by https://github.com/hzahradnik)"
If you prefer not to be mentioned in the README please let me know.
Måns Tånneryd Tånneryd IT AB Barrskogsvägen 19 186 53 Vallentuna +46-705140093 https://se.linkedin.com/in/manstanneryd
https://github.com/mtanneryd/ef6-bulk-operations https://github.com/mtanneryd/ef6-bulk-operations
Den ons 18 mars 2020 kl 10:30 skrev Brandinga notifications@github.com:
no hurry! you are doing a great job on this library. thanks (head of hzahradnik)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mtanneryd/ef6-bulk-operations/pull/30#issuecomment-600500450, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2BSRPLI57LUEGHUX54KVDRICEGBANCNFSM4LOJJH7Q .
As we already successfully use the latest version, this PR should be obsolete.
Thank you, great project. 👍
We found another problem with this library when using for our project. When a table has a computed column, the current version tries to insert this column, which of course fails as it is not allowed to insert a specific value to a computed column.
As a solution, the call to select the properties now filters a column, if
IsStoreGeneratedComputed
is true. To test this, I refactored the context I added in the previous PR #29 and added a computed column. As a consequence I had to reorder the existing migrations.Unfortunately, I added the changes onto #29, instead of adding it onto your master. I looked into rebasing, but as I use the same context, it would be rather difficult. If you want, I can try, but for now I leave it like it is and rebase it, if you merge #29.
If you need anything else, you can ask us for help. We are eager to help.
Edit: As you can see in the commits, I have wrongly used identity column. To avoid any misunderstandings, the fix is for computed columns.