Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Linq to entities - what is wrong here.
Message
Information générale
Forum:
ASP.NET
Catégorie:
Silverlight
Divers
Thread ID:
01524523
Message ID:
01524540
Vues:
60
Damn. Obvoiusly I've wasted my time with trying to figure out EF (at least for use with Silverlight).
I'll have to learn WCF services and just do all the data access from there apparently.


>
>(the learning curve I have currently is like climbing a steep mountain of loose gravel)...
>
>OK. I have a silverlight 4 app. EF datamodel of my SQL database. Domain DataService making my Entities visible.
>
>Two entity tables are Projects and Change_Requests. Projects has primary key Project_ID. Change Requests has FK Product_ID. Change Requests have a SubdivisionID (int) field.
> 
>They seem to be functioning as entities correctly. The GetProjectsQuery and GetChange_RequestQuery queries seem to be functional (all built automatically when creating the datamodel and domainservice).
>
>This works fine..
>
>            EntityQuery<Project> query = (from P in _Context.GetProjectsQuery()
>                                          where P.Proj_Name.Contains(txtFilterProjectName.Text.Trim())
>                                          orderby P.Proj_Name
>                                          select P);
>            LoadOperation<Project> lo = _Context.Load<Project>(query);
>
>            DataGridProjects.ItemsSource = lo.Entities;
>
>GetChange_RequestQuery works ok too.
>
>Now I'm trying to do the equivalent of a join or subquery to get Projects that have Change_Requests in a specific Change_Request.SubdivisionID.
>
>I've tried..
>
>            EntityQuery<Project> query = (from p in _Context.Projects
>                                          from c in _Context.Change_Requests
>                                          where p.Project_ID == c.Project_ID && c.Subdivision == SubdivisionID
>                                          select p);
>
>I get an error ..
>Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<ChangeManagement.Web.Project>' to 'System.ServiceModel.DomainServices.Client.EntityQuery<ChangeManagement.Web.Project>'
>
>OK, let's try using the Getmethods (like the one that worked above)..
>
>            EntityQuery<Project> query = (from p in _Context.GetProjectsQuery()
>                                          from c in _Context.GetChange_RequestQuery()
>                                          where p.Project_ID == c.Project_ID
>                                              && c.Subdivision.Equals(SubdivisionID)
>                                          select p);
>
>Error..
>Could not find an implementation of the query pattern for source type 'System.ServiceModel.DomainServices.Client.EntityQuery<ChangeManagement.Web.Project>'.  'SelectMany' not found.
>
>OK  - let's try a join..
>            EntityQuery<Project> query = (from p in _Context.Projects
>                                          join c in _Context.Change_Requests on p.Project_ID equals c.Project_ID
>                                          where c.Subdivision.Equals(SubdivisionID)
>                                          select p);
>
>Error..
>Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<ChangeManagement.Web.Project>' to 'System.ServiceModel.DomainServices.Client.EntityQuery<ChangeManagement.Web.Project>'
>
>What am I missing?? Apparently working with more than one entity changes the query to IEnumerable rather than EntityQuery? 
>
>How do I get by this?
>
>
____________________________________

Don't Tread on Me

Overthrow the federal government NOW!
____________________________________
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform