EntityDataSourceContextCreatingEventArgs.Context Property
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.
Gets the ObjectContext that is used by the data source.
public:
property System::Data::Objects::ObjectContext ^ Context { System::Data::Objects::ObjectContext ^ get(); void set(System::Data::Objects::ObjectContext ^ value); };
public System.Data.Objects.ObjectContext Context { get; set; }
member this.Context : System.Data.Objects.ObjectContext with get, set
Public Property Context As ObjectContext
Property Value
The object context that is used by the data source.
Examples
The following example shows the creation of an ObjectContext variable of the Page object and its assignment to the Context property of the EntityDataSourceContextCreatingEventArgs object.
public partial class _Default : System.Web.UI.Page
{
AdventureWorksModel.AdventureWorksEntities objCtx =
new AdventureWorksModel.AdventureWorksEntities();
protected void EntityDataSource2_ContextCreating(object sender,
EntityDataSourceContextCreatingEventArgs e)
{
e.Context = objCtx;
}
}
Remarks
The Context property can be assigned to a long-running ObjectContext in the handler for the ContextCreating event. For more information, see Object Context Life-Cycle Management (EntityDataSource).
Applies to
الملاحظات
https://aka.ms/ContentUserFeedback.
قريبًا: خلال عام 2024، سنتخلص تدريجيًا من GitHub Issues بوصفها آلية إرسال ملاحظات للمحتوى ونستبدلها بنظام ملاحظات جديد. لمزيد من المعلومات، راجعإرسال الملاحظات وعرضها المتعلقة بـ