EntityDataSource.ContextDisposing Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs before an ObjectContext is disposed of.
public:
event EventHandler<System::Web::UI::WebControls::EntityDataSourceContextDisposingEventArgs ^> ^ ContextDisposing;
public event EventHandler<System.Web.UI.WebControls.EntityDataSourceContextDisposingEventArgs> ContextDisposing;
member this.ContextDisposing : EventHandler<System.Web.UI.WebControls.EntityDataSourceContextDisposingEventArgs>
Public Custom Event ContextDisposing As EventHandler(Of EntityDataSourceContextDisposingEventArgs)
Event Type
Examples
To keep an existing ObjectContext instance member for future reference cancel the ContextCreated event as shown by the following code.
protected void EntityDataSource2_ContextDisposing(object sender,
EntityDataSourceContextDisposingEventArgs e)
{
e.Cancel = true;
}
Remarks
Handle this event to prevent the ObjectContext used by the EntityDataSource control from being disposed of. Do this when you want to use a single ObjectContext instance in your page with several controls or instances of the EntityDataSource control. To prevent the ObjectContext from being disposed of, set the Cancel property of the EntityDataSourceContextDisposingEventArgs object to true
. For more information, see Object Context Life-Cycle Management (EntityDataSource). For more information about the object context, see Identity Resolution, State Management, and Change Tracking.
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om