EntityDataSourceContextCreatingEventArgs 類別

定義

提供 ContextCreating 事件的資料。

public ref class EntityDataSourceContextCreatingEventArgs : EventArgs
public class EntityDataSourceContextCreatingEventArgs : EventArgs
type EntityDataSourceContextCreatingEventArgs = class
    inherit EventArgs
Public Class EntityDataSourceContextCreatingEventArgs
Inherits EventArgs
繼承
EntityDataSourceContextCreatingEventArgs

範例

下列範例示範如何建立 ObjectContext 物件的變數 Page ,以及其指派給 Context 物件的 屬性 EntityDataSourceContextCreatingEventArgs

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;  
        }  
    }  

備註

物件 EntityDataSourceContextCreatingEventArgs 具有 Context 屬性,可指派給事件處理常式 ContextCreating 中長時間執行 ObjectContext 的屬性。 如需詳細資訊,請參閱 Object CoNtext Life-Cycle Management (EntityDataSource)

屬性

Context

取得資料來源使用的 ObjectContext

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於