Santhosh Patil

Santhosh Patil

  • 960
  • 1.5k
  • 139.7k

The ObjectContext instance has been disposed and can no long

May 17 2019 4:05 AM
Hi Team ,
 
 
if (Data != null)
{
response.Write(JsonSerializer.SerializeToString(Data)); getting error here 
}
The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
 
 
System.ObjectDisposedException
HResult=0x80131622
Message=The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
Source=EntityFramework
StackTrace:
at System.Data.Entity.Core.Objects.ObjectContext.get_Connection()
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.Execute(MergeOption mergeOption)
at System.Data.Entity.Core.Objects.DataClasses.EntityCollection`1.Load(List`1 collection, MergeOption mergeOption)
at System.Data.Entity.Core.Objects.DataClasses.EntityCollection`1.Load(MergeOption mergeOption)
at System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.DeferredLoad()
at System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.LoadProperty[TItem](TItem propertyValue, String relationshipName, String targetRoleName, Boolean mustBeNull, Object wrapperObject)
at System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.<>c__DisplayClass7`2.<GetInterceptorDelegate>b__1(TProxy proxy, TItem item)
at System.Data.Entity.DynamicProxies.RBT_SCHED_AB86288A918D71FFE8A0B90BDAF038DB4EC6FC7B7DDE67D760ACB9797E6824DC.get_RBT_SCHED_DTL()
at ServiceStack.Text.Common.WriteType`2.WriteProperties(TextWriter writer, Object value)
at ServiceStack.Text.Common.WriteListsOfElements`2.WriteGenericIList(TextWriter writer, IList`1 list)
at ServiceStack.Text.Common.WriteListsOfElements`2.WriteIList(TextWriter writer, Object oList)
at ServiceStack.Text.Common.WriteType`2.WriteProperties(TextWriter writer, Object value)
at ServiceStack.Text.Common.WriteListsOfElements`2.WriteGenericIList(TextWriter writer, IList`1 list)
at ServiceStack.Text.Common.WriteListsOfElements`2.WriteList(TextWriter writer, Object oList)
at ServiceStack.Text.Common.WriteType`2.WriteProperties(TextWriter writer, Object value)
at ServiceStack.Text.JsonSerializer.SerializeToString(Object value, Type type)
at ServiceStack.Text.JsonSerializer.SerializeToString[T](T value)
at ClientPricing.Web.Infrastructure.ServiceStackJsonResult.ExecuteResult(ControllerContext context) in C:\Client\Cigna.Pharmacy.Client.Pricing.Web\trunk\src\ClientPricing.Web\Infrastructure\ServiceStackJsonResult.cs:line 26
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
 

Answers (1)