Possible Duplicate:
LINQPad error: ‘UserQuery’: cannot derive from sealed type ‘My.Entity.Framework.CustomDataContext’
i am running this query in LINQPad 4 with C# Expression as language
from t in typeof(UserQuery).GetProperties()
where t.Name == "tablename"
from c in t.GetValue(this,null).GetType().GetGenericArguments()[0].GetFields()
select c.Name
but when i use this query in C# web application it gives error no reference of UserQuery
var result = from t in typeof(UserQuery).GetProperties()
where t.Name == "tablename"
from c in t.GetValue(this,null).GetType().GetGenericArguments()[0].GetFields()
select c.Name
and vs 2012 intellisense didnt picked any reference of it. please tell me which library reference is needed to be added for execution of above query or which class object is needed to be created for referencing ??
currently i m using EF 5.0 and DbContext object which is generated when creating EF data model by Database First Approach
i prefer answer which related to DbContext
UserQuery
is the class LINQPad uses as a container for the code you enter into its textfield. As such, it is only available to code you run in LINQPad.
It sounds like you're trying to query the properties of a typed data context.
To get this working in Visual Studio, replace UserQuery with the name of your typed DataContext.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With