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

InsertBulk throws ArgumentNullException #29

Closed
dustinhorne opened this issue Jul 11, 2013 · 2 comments
Closed

InsertBulk throws ArgumentNullException #29

dustinhorne opened this issue Jul 11, 2013 · 2 comments

Comments

@dustinhorne
Copy link

The InsertBulk method throws an ArgumentNull exception. It appears to be thrown when initializing the SqlBulkLoader (the 'connection' parameter is null). This is occurring with the latest NuGet package.

System.ArgumentNullException: Value cannot be null. Parameter name: connection

the code to reproduce is as basic as it comes:

using(var db = new MyNPocoDbObject("<connection string>", "System.Data.SqlClient"))
{
    db.InsertBulk(myPocoList);
}

UPDATE:
If I change the code to the following it works just fine:

using(var db = new MyNPocoDbObject("<connection string>", "System.Data.SqlClient"))
{
    db.OpenSharedConnection();
    db.InsertBulk(myPocoList);
    db.CloseSharedConnection();
}

I actually have a static GetInstance() method which resolves my connection string based on the current environment and then returns the database object using the above constructor, but I just demonstrated with the constructor for simplicity. All other regular operations work just fine, but I get the exception on the InsertBulk.

@schotime
Copy link
Owner

Thanks for the report.
I will have a look and get back to you.
Adam

@schotime
Copy link
Owner

I have fixed this and put in 2.1.30 on NuGet.
Thanks.

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