EntitySet<TEntity>.Assign method
Replaces the entities currently associated with this EntitySet<TEntity> with the specified collection.
Namespace: Microsoft.SharePoint.Linq
Assembly: Microsoft.SharePoint.Linq (in Microsoft.SharePoint.Linq.dll)
Syntax
'Declaration
Public Sub Assign ( _
entities As IEnumerable(Of TEntity) _
)
'Usage
Dim instance As EntitySet
Dim entities As IEnumerable(Of TEntity)
instance.Assign(entities)
public void Assign(
IEnumerable<TEntity> entities
)
Parameters
entities
Type: System.Collections.Generic.IEnumerable<TEntity>The collection of entities with which the current set is replaced.
Remarks
Typically, this method is called by the set accessor of an EntitySet<TEntity> property. It calls the OnChanging handler before it writes a new set of values to the EntitySet<TEntity>. It calls OnChanged just after it writes a new set of values to the EntitySet<TEntity>.
Examples
The following code shows Assign(IEnumerable<TEntity>) in use:
[ContentType(Name="Item", Id="0x01", List="Team Members")]
[DataContract()]
public partial class TeamMembersItem : Item {
[DataMember()]
private EntitySet<Project> _projects;
public TeamMembersItem() {
this._manager = new EntitySet<Project>();
this.Initialize();
}
[Association(Name="AssignedProjects", Storage="_projects ", MultivalueType=AssociationType.Multi, List="Projects")]
public EntitySet<Project> AssignedProjects {
get {
return this._projects;
}
set {
this._projects.Assign(value);
}
}
// Other members omitted for readability.
}