EntityRef<TEntity>.GetEntity 方法

返回由该EntityRef<TEntity>对象的实体。

命名空间:  Microsoft.SharePoint.Linq
程序集:  Microsoft.SharePoint.Linq(位于 Microsoft.SharePoint.Linq.dll 中)

语法

声明
Public Function GetEntity As TEntity
用法
Dim instance As EntityRef
Dim returnValue As TEntity

returnValue = instance.GetEntity()
public TEntity GetEntity()

返回值

类型:TEntity
Object 表示此EntityRef<TEntity>对象的private字段中存储的实体。

备注

与get包装专用EntityRef<TEntity>字段的属性的访问器中调用此方法允许使用标准属性读取其中 T 该属性 (和专用的EntityRef<TEntity>字段的类型参数) 的类型的语法属性值被分配给一个对象类型,而不是类型EntityRef<TEntity>时, 要读取的属性。

示例

下面的代码演示在使用GetEntity() :

[ContentType(Name="Item", Id="0x01", List="Clients")]
public partial class ClientsItem : Item 
{
    private EntityRef <SalesStaff> _clientRepresentative;

    [Association(Name="ClientRepresentative", Storage="_city", MultivalueType=AssociationType.Single, List="Sales Staff")]
    public SalesStaff ClientRepresentative {
        get {
            return this._clientRepresentative.GetEntity();
        }
        set {
            this._clientRepresentative.SetEntity(value);
        }
    }

    // Other members omitted for readability.
}
<ContentType(Name:="Item", Id:="0x01", List:="Clients")>
Partial Public Class ClientsItem
    Inherits Item
    Private _clientRepresentative As EntityRef(Of SalesStaff)

    <Association(Name:="ClientRepresentative", Storage:="_city", MultivalueType:=AssociationType.Single, List:="Sales Staff")>
    Public Property ClientRepresentative() As SalesStaff
        Get
            Return Me._clientRepresentative. GetEntity()
        End Get
        Set(ByVal value As SalesStaff)
            Me._clientRepresentative.SetEntity(value)
        End Set
    End Property

    ' Other members omitted for readability.
End Class

另请参阅

引用

EntityRef<TEntity> 类

EntityRef<TEntity> 成员

Microsoft.SharePoint.Linq 命名空间