This project has moved and is read-only. For the latest updates, please go here.


EF and SqlBulkUpdate + SqlBulkDelete



Thanks for these extension methods, very useful!
I've experienced a problem using the SqlBulkUpdate + SqlBulkDelete methods, but the SqlBulkInsert works perfectly. It's the extension methods for the EF DbContext object.

I get the error: System.NullReferenceException
And the stack trace is:
at Z.Utility.SqlBulkOperation.EnsureIdentityKeyIsSet() in c:\Users\Jonathan\Desktop\Z\TFS\zExtensionMethods\Z.ExtensionMethods.EntityFramework_Internal\SqlBulkOperation\SqlBulkOperation.BLL.EnsureIdentityKeyIsSet.cs:line 22
at Z.Utility.SqlBulkOperation.BulkUpdate() in c:\Users\Jonathan\Desktop\Z\TFS\zExtensionMethods\Z.ExtensionMethods.EntityFramework_Internal\SqlBulkOperation\SqlBulkOperation.BWL.BulkUpdate.cs:line 19
at DbContexttExtension.SqlBulkUpdate[T](DbContext this, IEnumerable1 entities, Action1 sqlBulkCopyFactory) in c:\Users\Jonathan\Desktop\Z\TFS\zExtensionMethods\Z.ExtensionMethods.EntityFramework\DbContext\BulkOperation\DbContext.SqlBulkUpdate.cs:line 65
at DbContexttExtension.SqlBulkUpdate[T](DbContext this, IEnumerable`1 entities) in c:\Users\Jonathan\Desktop\Z\TFS\zExtensionMethods\Z.ExtensionMethods.EntityFramework\DbContext\BulkOperation\DbContext.SqlBulkUpdate.cs:line 78

It seems like you are testing wether there is an identity key on the table, but in my case, the primary key column is not an identity column (and no, I cannot just change it to an identity column since I do not own the database). Does this mean that I cannot use the bulk update/delete operations?

Thanks in advance for the answer!
Closed Jun 4, 2014 at 1:38 AM by Jonathan_Magnan


Jonathan_Magnan wrote Apr 8, 2014 at 1:37 AM

Fixed in version

wrote Jun 4, 2014 at 1:38 AM

wrote Jun 4, 2014 at 1:39 AM

wrote Jun 4, 2014 at 1:39 AM