This question is locked. New answers and comments are not allowed.
I am using an ObjectAccessLINQDataSource, which I wish to initiate using a custom ConnectionString (using non-integrated security, and current user logged in). The documentation mentions 3 techniques for managing the dbContext of the OALDS, 1st 2 of which are:
1. Using master pages to hold the context
2. using httpcontext, and the ContextFactory code supplied.
Simple cases all seem to work fine. Problem occurs when you update the record, using auto-configuration, not coded, and custom initialising the context. It appears that updating records all works fine if you use wizard configuration, that only supports fixed connection strings,
BUT
When you initialise the context, using the OALDS OnContextCreating event, work until AFTER you do an update, which by the way succeeds as far as updating the record in the dataset, but when it then reacquires the data from the source, an exception is thrown:
System.ObjectDisposedException was unhandled by user code
Message=The context has already been disposed and it's managed persistent objects can no longer be accessed. The context should be disposed at the end of the life cycle of your business logic instance. This can also be done in the Dispose of your ASP page or MVC controller.
Object name: 'Telerik.OpenAccess.OpenAccessContextBase'.
Source=Telerik.OpenAccess
ObjectName=Telerik.OpenAccess.OpenAccessContextBase
StackTrace:
at Telerik.OpenAccess.OpenAccessContextBase.CheckNotDisposed()
at Telerik.OpenAccess.OpenAccessContextBase.GetScope()
at Telerik.OpenAccess.OpenAccessContext.GetAllCore[T]()
at Telerik.OpenAccess.OpenAccessContext.GetAll[T]()
at WebClient.DataEntities.get_Accounts() in C:\Users\pholmes\Documents\Development Projects\Sirrus\WebClient\WebClient\EntityDiagrams.cs:line 82
InnerException:
Important points here. I have NOT disposed the context. I have even put event handler in on the OALDS OnContextDisposing event to see if it is getting fired, and it is not.
Any input here?
1. Using master pages to hold the context
2. using httpcontext, and the ContextFactory code supplied.
Simple cases all seem to work fine. Problem occurs when you update the record, using auto-configuration, not coded, and custom initialising the context. It appears that updating records all works fine if you use wizard configuration, that only supports fixed connection strings,
BUT
When you initialise the context, using the OALDS OnContextCreating event, work until AFTER you do an update, which by the way succeeds as far as updating the record in the dataset, but when it then reacquires the data from the source, an exception is thrown:
System.ObjectDisposedException was unhandled by user code
Message=The context has already been disposed and it's managed persistent objects can no longer be accessed. The context should be disposed at the end of the life cycle of your business logic instance. This can also be done in the Dispose of your ASP page or MVC controller.
Object name: 'Telerik.OpenAccess.OpenAccessContextBase'.
Source=Telerik.OpenAccess
ObjectName=Telerik.OpenAccess.OpenAccessContextBase
StackTrace:
at Telerik.OpenAccess.OpenAccessContextBase.CheckNotDisposed()
at Telerik.OpenAccess.OpenAccessContextBase.GetScope()
at Telerik.OpenAccess.OpenAccessContext.GetAllCore[T]()
at Telerik.OpenAccess.OpenAccessContext.GetAll[T]()
at WebClient.DataEntities.get_Accounts() in C:\Users\pholmes\Documents\Development Projects\Sirrus\WebClient\WebClient\EntityDiagrams.cs:line 82
InnerException:
Important points here. I have NOT disposed the context. I have even put event handler in on the OALDS OnContextDisposing event to see if it is getting fired, and it is not.
Any input here?