c# - execute custom sql with entity framework4 -


i have receive workorders database, specific user.

the filter users different, 1 must order shipped uk, ont 5 other countries, 1 high value things, 1 al order containt > 10 items etc.

so, came idea (shoot @ if have better one!)

i create view each user, , views return same data, filter different.

in ado.net this:

string sql = "select * vwworkorders" + username; [rest of ado.net here] 

but i'm using ef4, , wondering equivalent of kind of code.

you can use executestorequery method in following example:

context.executestorequery<vwworkorder>(sql); 

this method allows execute storage sql , obtain strongly-typed results.
in case need pass parameters, pass necessary objectparameter instances in call of executestorequery.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -