Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns the entity that is wrapped by this EntityRef<TEntity> object.
Namespace: Microsoft.SharePoint.Linq
Assembly: Microsoft.SharePoint.Linq (in Microsoft.SharePoint.Linq.dll)
Syntax
'Declaration
Public Function GetEntity As TEntity
'Usage
Dim instance As EntityRef
Dim returnValue As TEntity
returnValue = instance.GetEntity()
public TEntity GetEntity()
Return Value
Type: TEntity
A Object that represents the entity that is stored in a private field of this EntityRef<TEntity> object.
Remarks
Calling this method with the get accessor of a property that wraps a private EntityRef<TEntity> field enables the property to be read with standard property reading syntax when the property value is being assigned to an object of type T, rather than type EntityRef<TEntity>, where T is the type of the property (and the type parameter of the private EntityRef<TEntity> field).
Examples
The following code shows GetEntity() in use:
[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