RelationshipManager.InitializeRelatedCollection<TTargetEntity> Method (String, String, EntityCollection<TTargetEntity>)
Takes an existing EntityCollection that was created with the default constructor and initializes it using the provided relationship and target role names. This method is designed to be used during deserialization only, and will throw an exception if the provided EntityCollection has already been initialized, or if the relationship manager is already attached to a ObjectContext.
Assembly: EntityFramework (in EntityFramework.dll)
[BrowsableAttribute(false)] [EditorBrowsableAttribute(EditorBrowsableState.Never)] public void InitializeRelatedCollection<TTargetEntity>( string relationshipName, string targetRoleName, EntityCollection<TTargetEntity> entityCollection ) where TTargetEntity : class
Parameters
- relationshipName
-
Type:
System.String
The relationship name.
- targetRoleName
-
Type:
System.String
The target role name.
- entityCollection
-
Type:
System.Data.Entity.Core.Objects.DataClasses.EntityCollection<TTargetEntity>
An existing EntityCollection.
Type Parameters
- TTargetEntity
Type of the entity represented by targetRoleName