Select from following answers:- Create the DataContext without a using statement and do not call Dispose.

- Set the DataContextObjectTrackingEnabled property to False.
- Set the DataContextDeferredLoadingEnabled property to False.
- All Above
The C# using (Using in Visual Basic) statement provides a convenient syntax that ensures the correct use of IDisposable objects. The using statement calls the Dispose method on the object when program execution exits the using block. When you are relying on lazy loading, you cannot dispose of the data context before properties are lazy loaded. The entity objects will require the data context to lazy load properties. To fix the exception, you can remove the using to not dispose and allow the data context to be disposed when the related objects are garbage collected. Alternatively, you can explicitly load the child property before disposing of the data context.
Show Correct Answer
Source: MeasureUp.com | |
Alert Moderator