1

I am trying to create a system as follows -

  1. UI layer - dropdowns with options to filter the data to be shown

  2. Mid layer - ".cs" classes to manipulate the data

  3. Back Layer - here the data gets filtered and returned into classes (EDMX file and classes)

However my implementation is not working... the error is shown as "Reference for different contexts"..

protected void Page_Load(object sender, EventArgs e)
{
    inc = (IQueryable<Incident_Raw_Data>)Session["INC"];
    AppInfo = (IQueryable<Application_Info>)DbData.GetDBData().AppInfo;
    RespConfg = (IQueryable<Response_Config>)DbData.GetDBData().RespConfig;
    ResolConfg = (IQueryable<Resolution_Config>)DbData.GetDBData().ResolConfig;

    DTbl = QueryRslt(xyz, abc);
    Data = GetData();
    Cols = Col();
}

Never mind any return statements missing ;;

public DataTable QueryRslt(string Type, string Value)
{
    if (!string.IsNullOrEmpty(Type))
    {
        var str = (from IR in inc
                   join AI in AppInfo on IR.CI equals AI.Application_Name
                   join RC in RespConfg on AI.Service_Level_Categoty equals RC.Category
                   where (RC.Tkt_Type == "Incident" && IR.Priority == Value)
                   select new
                   {
                       ID = IR.Incident_ID,
                       CI = IR.CI,
                       Status = IR.Status,
                       BenchMark_Response_Time = RC.Days_Benchmark,
                       SLMDeviation = ((EntityFunctions.DiffHours(IR.Incident_Reported_Date, IR.Incident_Responded_Date) / 24.0) - RC.Days_Benchmark),
                       Priority = IR.Priority,
                       ReportedDate = IR.Incident_Reported_Date,
                       RespondDate = IR.Incident_Responded_Date,
                       AssigneeGroup = IR.Assignee,
                       AssignedGroup = IR.Assigned_Group
                   }).ToList();
    }
}
2
  • You should practice to avoid storing Tables or large data in Session. Commented Apr 19, 2013 at 11:52
  • See stackoverflow.com/questions/7024100/… Commented Apr 19, 2013 at 12:44

1 Answer 1

2

It looks like you are trying to joins different data contexts. That is not supported.

You should also instanciate the data context object when you need it and not store it in the session, as i guess you are dooing with the "INC".

inc, APPInfo and RestConf must not be collected from different instances of the data context.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.