c# - Generic entity for raw queries in Entity Framework -


i using ef , have execute custom queries user can create need.

i know raw queries have use sqlquery, not know object query returns.

i using unitofwork pattern:

public class repository<tentity> : irepository<tentity> tentity:class {     cellularfivelocalentities context = null;     public repository()     {         context = new cellularfivelocalentities();     }      private dbset<tentity> entityset     {         { return context.set<tentity>(); }     }      public list<string> rawquery(string query)     {         list<string> result = null;          try {             var entity = context.set<string>();             result = entity.sqlquery(query).tolist();         }         catch (exception ex) {              throw ex;         }          return result;     }      public void dispose()     {         if (context != null)         {             context.dispose();         }     } } 

how can use generic object custom queries?


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -