I am working on EF with C# and WPF as front end. I need to provide a UI for so user can create his own query and get the result. The UI will be list of tables and list of columns to select from (Not happy with UI. Need to improve but new ticks in my mind).
So my question is how create, merge(existing query) and execute the queries.
There are sql class Entity Client provider, objectquery class. I used ObjectQuery
string querystring = @"SELECT PrjDev FROM prjscenario";
ObjectQuery<PrjDev> prjdevquery = new ObjectQuery<PrjDev>(querystring, ptxobjcontext);
string cpmmandtext = prjdevquery.CommandText;
int prjdevnum = prjdevquery.Count();
It is working. But when i run some complex query. It is not working. Example code :
string querystring = @"SELECT PrjDev FROM prjscenario WHERE PrjDev.PrjDevType = 10";
Error :
'PrjDevType' is not a member of 'Transient.collection[Skm.Ptx.Data.Emf.PrjDev(Nullable=True,DefaultValue=)]'. To extract a property of a collection element, use a subquery to iterate over the collection. Near simple identifier, line 1, column 45.
Any Idea, why it is good for one simple query but it is not working for complex queries?
Thanks in Advance, N