Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Entity Framework 101
Message
From
04/06/2014 10:46:18
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
 
To
04/06/2014 10:07:37
General information
Forum:
ASP.NET
Category:
Entity Framework
Environment versions
Environment:
C# 4.0
OS:
Windows 8
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01601183
Message ID:
01601268
Views:
28
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/
Previous
Reply
Map
View

Click here to load this message in the networking platform