语言

ObjectContext.CreateObject<T> 方法

定义

创建并返回所请求类型的实例。

public virtual T CreateObject<T>() where T : class;
abstract member CreateObject : unit -> 'T (requires 'T : null)
override this.CreateObject : unit -> 'T (requires 'T : null)
Public Overridable Function CreateObject(Of T As Class) () As T

类型参数

T

要返回的对象的类型。

返回

T

请求的类型 T 的实例,或派生类型的实例,使 T 能够与实体框架一起使用。 返回的对象是请求类型的实例,或者是派生类型的实例,该实例使请求的类型能够与 Entity Framework 一起使用。

适用于