Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Linqtoentities syntax
Message
From
01/07/2010 13:47:09
Stan Blatti
Shelby Residential & Vocational Services
Memphis, Tennessee, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Linqtoentities syntax
Environment versions
Environment:
C# 4.0
OS:
Windows Server 2008
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01471213
Message ID:
01471213
Views:
81
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!
Next
Reply
Map
View

Click here to load this message in the networking platform