Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Linqtoentities syntax
Message
De
01/07/2010 13:47:09
Stan Blatti
Shelby Residential & Vocational Services
Memphis, Tennessie, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Linqtoentities syntax
Versions des environnements
Environment:
C# 4.0
OS:
Windows Server 2008
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01471213
Message ID:
01471213
Vues:
82
When using EF 4, MM 4, VS2010 and the following LINQ query in MM biz tier,
 IQueryable<ClientEntity> query = from o in this.ObjectContext.ClientEntities
                                                             select o;
            return this.GetEntityList(query);
what is the syntax to bring back a subset of fields,
select new {o.FirstName, o.LastName}; doesn't work; however, the foreach analysis does, but that is not what I want to return.
It gives me an error that I am trying to implicitly cast an anonymous type to my 'MM entity' type and implies that there is a specific cast for this, I don't know what this would be. I really don't want to bring back a large number of fields when I only need a few. Maybe I have to build a separate EF class for just this purpose but it seems like a waste. I couldn't find anything on this in the MM Guide.
Thanks for any help!
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform