다음을 통해 공유


AssociationAttribute Class

Specifies that the property (mapped to a list field) has an association to another list, such as when the property is mapped to a lookup field.

Inheritance Hierarchy

System.Object
  System.Attribute
    Microsoft.SharePoint.Linq.DataAttribute
      Microsoft.SharePoint.Linq.AssociationAttribute

Namespace:  Microsoft.SharePoint.Linq
Assembly:  Microsoft.SharePoint.Linq (in Microsoft.SharePoint.Linq.dll)

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Field, AllowMultiple := False)> _
Public NotInheritable Class AssociationAttribute _
    Inherits DataAttribute
'Usage
Dim instance As AssociationAttribute
[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
public sealed class AssociationAttribute : DataAttribute

Examples

The following example shows the attribute used in the declaration of a property that represents a Lookup column to a Managers list.

[Association(Name="Manager", Storage="_manager", MultivalueType=AssociationType.Multi, List="Managers")]
public EntitySet<Item> Manager {
    get {
        return this._manager;
    }
    set {
        this._manager.Assign(value);
    }
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

AssociationAttribute Members

Microsoft.SharePoint.Linq Namespace