New problem with linq just started ... anyone seen this?
-
I have one application that we lost the source code to that I'm rewriting and another app I'm writing to help a business partner that I started yesterday. I created a class project, removed the Class1 library, then added the Linq to Sql class type. So far so good. I added my tables and queries and rebuilt the application to start coding. But when I start my normal process
using (MasterContext context = new MasterContext()){}
I keep getting the error that the context cannot be converted to IDisposable. WTF???!!!! I've done everything I can think of but I keep getting this error. Also if I get rid of the using a write a select, the variable used in the from statement refuses to expand. Now I know that is usually a sign that I've screwed something up, but I cannot see what it could possibly be. Any input would be greatly appreciated. Michael -
I have one application that we lost the source code to that I'm rewriting and another app I'm writing to help a business partner that I started yesterday. I created a class project, removed the Class1 library, then added the Linq to Sql class type. So far so good. I added my tables and queries and rebuilt the application to start coding. But when I start my normal process
using (MasterContext context = new MasterContext()){}
I keep getting the error that the context cannot be converted to IDisposable. WTF???!!!! I've done everything I can think of but I keep getting this error. Also if I get rid of the using a write a select, the variable used in the from statement refuses to expand. Now I know that is usually a sign that I've screwed something up, but I cannot see what it could possibly be. Any input would be greatly appreciated. MichaelDoes MasterContext implement IDisposable? If not you can't have it in a using
-
I have one application that we lost the source code to that I'm rewriting and another app I'm writing to help a business partner that I started yesterday. I created a class project, removed the Class1 library, then added the Linq to Sql class type. So far so good. I added my tables and queries and rebuilt the application to start coding. But when I start my normal process
using (MasterContext context = new MasterContext()){}
I keep getting the error that the context cannot be converted to IDisposable. WTF???!!!! I've done everything I can think of but I keep getting this error. Also if I get rid of the using a write a select, the variable used in the from statement refuses to expand. Now I know that is usually a sign that I've screwed something up, but I cannot see what it could possibly be. Any input would be greatly appreciated. MichaelSystem.Data.Linq.DataContext
implementsIDisposable
, soMasterContext
will too if it subclassesSystem.Data.Linq.DataContext
. Check your inheritance hierarchy (not forgetting partial class files). It is also possible that something has gone wrong in auto-generation, if all else fails, I suggest is a restart (which fixes a surprising number of the odder problems).Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter. Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
-
System.Data.Linq.DataContext
implementsIDisposable
, soMasterContext
will too if it subclassesSystem.Data.Linq.DataContext
. Check your inheritance hierarchy (not forgetting partial class files). It is also possible that something has gone wrong in auto-generation, if all else fails, I suggest is a restart (which fixes a surprising number of the odder problems).Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter. Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
That was the 'trick'. Everything that was 'broken' last night works today.
-
Does MasterContext implement IDisposable? If not you can't have it in a using
You must not know anything about Linq to Sql. MasterContext in a Linq to Sql class inherits DataContext which implements IDisposable. Also the documentation for Linq to Sql has almost the first line stating you should always use using() when creating a DataContext.
-
You must not know anything about Linq to Sql. MasterContext in a Linq to Sql class inherits DataContext which implements IDisposable. Also the documentation for Linq to Sql has almost the first line stating you should always use using() when creating a DataContext.
You're right, I don't know anything about Linq to SQL ;P