Quantcast
Channel: entityframework Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1793

New Post: EF6 support for ASP.NET WebForms EntityDataSource

$
0
0
I am not sure if this is related to this thread, but I just created a simple EF6 project and am running into problems trying to get an ObjectContext out of a dbContext. I need to do this in order to open and close the database as I have been doing with EF5 as follows:

while (((IObjectContextAdapter)dbContext).ObjectContext.Connection.State.ToString() != "Open")
    ((IObjectContextAdapter)dbContext).ObjectContext.Connection.Open();
and

try
  {
    ((IObjectContextAdapter)dbContext).ObjectContext.Connection.Close();
  }
  finally
  {
    ((IObjectContextAdapter)dbContext).ObjectContext.Connection.Dispose();
  }
How can I do it? Alternately, is there a different recommended method to accomplish this now?

I am also using the ObjectContext to execute SQL. What is the recommended method to do this with EF6?

Thanks
Manish

Viewing all articles
Browse latest Browse all 1793

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>