Dbcontext executes StoreQuery

c# dbcontext entity-framework linq objectcontext

Question

I want to employExecuteStoreQuery I was puzzled by the lack of an Entity Framework method for my context variable.ExecuteStoreQuery method.

I thus learned that it is a technique forObjectContext although I've already used it in classDbContext for my submission. Simply put, I had attempted to adapt.DbContext with ObjectContext yet it resulted in various issues (for instance, ObjectContext isn'tOnModelCreating method).

How do I useExecuteStoreQuery if I can't, are there any alternatives to DbContext?ExecuteStoreQuery in the DbContext?

1
24
9/11/2012 1:44:26 PM

Accepted Answer

A DbContext is only a covering for theObjectContext .

The initial is still availableObjectContext using the IObjectContextAdapter

(dbContext as IObjectContextAdapter).ObjectContext;
38
12/28/2011 1:28:24 PM

Popular Answer

In addition, I believe that the current approach is the following:

dbContext.Database.SqlQuery<T>(string sql);


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow