RelatedEnd.Attach<TEntity>(IEnumerable<TEntity>, Boolean) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Defines a relationship between two attached objects.
protected public:
generic <typename TEntity>
void Attach(System::Collections::Generic::IEnumerable<TEntity> ^ entities, bool allowCollection);
protected internal void Attach<TEntity> (System.Collections.Generic.IEnumerable<TEntity> entities, bool allowCollection);
member this.Attach : seq<'Entity> * bool -> unit
Protected Friend Sub Attach(Of TEntity) (entities As IEnumerable(Of TEntity), allowCollection As Boolean)
- TEntity
The type of the IEnumerable<T> collection of entity objects to attach.
- entities
- IEnumerable<TEntity>
An IEnumerable<T> collection of entity objects.
- allowCollection
- Boolean
Specifies whether the object being attached is part of a collection.
The Attach<TEntity>(IEnumerable<TEntity>, Boolean)
method is used to define a relationship between an object and a related object when both objects are already attached to an object context. Set the related object to the Value property of the EntityReference<TEntity> or call the Add method on the EntityCollection<TEntity> if the related object is not already attached to the object context. When both objects are detached, you can also define the relationship by setting the related object to the Value property of the EntityReference<TEntity> or by calling the Add method on the EntityCollection<TEntity> and then attaching the root object in the object graph. For more information, see Attaching and Detaching Objects.
The Attach<TEntity>(IEnumerable<TEntity>, Boolean)
method is called by Object Services during attach operations against a related end.
Produkt | Versjoner |
---|---|
.NET Framework | 3.5 |
.NET-tilbakemelding
.NET er et åpen kilde-prosjekt. Velg en kobling for å gi tilbakemelding: