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

Bulk Insert does not respect identity insert option #393

Open
jcwrequests opened this issue Jan 13, 2017 · 1 comment
Open

Bulk Insert does not respect identity insert option #393

jcwrequests opened this issue Jan 13, 2017 · 1 comment

Comments

@jcwrequests
Copy link

The best way to explain this is with code. The following works I can insert a value into an identity column

  using (var scope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.FromSeconds(5 * 60)))
                        {
                            
                            foreach(var item in results)
                            {
                                Simple.Data.Database.
                                OpenConnection(destionationDBConnectionString).
                                WithOptions(new Simple.Data.Ado.AdoOptions(commandTimeout: (5 * 60), identityInsert: true))
                                [this.destinationTableName].Insert(item);
                            }
                            scope.Complete();
                        }

This does not. The table puts in the identity value:

     using (var scope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.FromSeconds(5 * 60)))
                        

                            Simple.Data.Database.
                            OpenConnection(destionationDBConnectionString).
                            WithOptions(new Simple.Data.Ado.AdoOptions(commandTimeout: (5 * 60),identityInsert: true))
                            [this.destinationTableName].Insert(results);
                            scope.Complete();
                        }

I will try and examine the code and see if it can be fixed easily.

@jcwrequests
Copy link
Author

I have found the issue in the SqlBulkInserter and corrected it on a Forked version. While searching for the issue I noticed that the master branch version does not match the version on Nuget. The reason I even checked the version in the first place was the unchanged Forked code from master wasn't behaving the same as the code on Nuget. Does anyone know why this is the case?

jcwrequests pushed a commit to jcwrequests/Simple.Data that referenced this issue Jan 16, 2017
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

1 participant