Database connection not open on creating a dbContext

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
HadleyHope
Posts: 8
Joined: Thu 24 Jan 2013 14:44

Database connection not open on creating a dbContext

Post by HadleyHope » Thu 25 Jul 2013 13:56

The code we have been using is:

Code: Select all

TSDataContext ctx = new TSDataContext(ProjectConnectionString) { ObjectTrackingEnabled = !readOnly };
Previous to 4.6.287 we could then use ctx strait away in a LINQ or table object query. After upgrading any query now throws a error with the message that the connection is closed.

We have changed our code to:

Code: Select all

TSDataContext ctx = new TSDataContext(ProjectConnectionString) { ObjectTrackingEnabled = !readOnly };
ctx.Connection.Open();
The context is created by Entity Developer creating the model from a database.

But are wondering if a bug has been introduced?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Database connection not open on creating a dbContext

Post by MariiaI » Fri 26 Jul 2013 09:10

We couldn't reproduce the "Connection is closed" exception on our environment.
Please specify the stack trace of the exception and send us a sample project, so that we are able to investigate this issue in more details.

HadleyHope
Posts: 8
Joined: Thu 24 Jan 2013 14:44

Re: Database connection not open on creating a dbContext

Post by HadleyHope » Fri 26 Jul 2013 15:49

Thanks for the reply, I created a small sample project, when the context is created the connection is closed, but it does automatically open when a query is made.

Guess it must be something else in our solution that is causing a problem, anyway thanks for looking.


Regards Martin

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Database connection not open on creating a dbContext

Post by MariiaI » Mon 29 Jul 2013 07:58

HadleyHope wrote: Guess it must be something else in our solution that is causing a problem, anyway thanks for looking.
Please specify the following details:
- the type of your application, where the issue occurs ( Console, ASP.NET WEB, ASP.NET MVC, etc.);
- the full stack trace of the exception;
- some piece of code, where the exception occurs.

Post Reply