Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Entity Framework 101
Message
De
04/06/2014 10:46:18
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
04/06/2014 10:07:37
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Versions des environnements
Environment:
C# 4.0
OS:
Windows 8
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01601183
Message ID:
01601268
Vues:
29
You gotta .ToArray() those suckers. Don't let your Views execute the query.

>You don't need stored proc for this.
>
>Something like
>
>var customers = context.Customers.OrderBy(c => c.CompanyName);
>var customers = context.Customers.Where(c => c.State == "NY" && c.City == "New York");
>
>or mix them
>
>var customers = context.Customers.Where(c => c.State == "NY" && c.City == "New York").OrderBy(c => c.CompanyName);
>
>
>
>>
>>1. I need to display a list of possible selections in a dropdown list, so I want to select all the selections from my table and sort them alphabetically.
>>
>>2. I need to pull out a subset of data based on a couple parameters.
Very fitting: http://xkcd.com/386/
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform