locked
System.Data.Objects.ObjectContext System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext() RRS feed

  • Question

  • User229488726 posted

    i am using EF 5 

    its  Work fine until i add a store procedure .

    when i add store procedure and get data from i have  a error like 

    System.Data.Objects.ObjectContext System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext()

    my code is

    public List<sp_userQuestion_Result> userQuestion(Int64 Questionid)
    {
    try
    {

    var userquestion = _db.sp_userQuestion(Questionid).ToList();
    return userquestion;
    }
    catch (Exception ex)
    {
    throw ex;
    }

    how to solve the error 

    Monday, February 29, 2016 9:23 AM

All replies

  • User-986267747 posted

    Hi brajalalbrp,

    Based on your code snippet, I have created a demo reproduce your issue by using ef5 on my side, but it works fine. Could you please check the version of entity framework again?

    In addition, based on the thread below, if you upgrade your ef  from entity framework 5 to entity framework 6 , it could cause the issue, because EF 6 does not have System.Data.Objects.ObjectContext

    http://stackoverflow.com/questions/14106286/ef-6-system-data-objects-objectcontext-error

    Best regards,

    Klein Zhang

    Tuesday, March 1, 2016 9:00 AM