The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

AssociationAttribute Class

Identifies the end of an association that is involved in an object relationship.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v19.1.dll

Declaration

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true)]
public sealed class AssociationAttribute : Attribute
<AttributeUsage(AttributeTargets.Property Or AttributeTargets.Field, Inherited:=True)>
Public NotInheritable Class AssociationAttribute
    Inherits Attribute
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true)]
public sealed class AssociationAttribute : Attribute
<AttributeUsage(AttributeTargets.Field Or AttributeTargets.Property, Inherited:=True)>
Public NotInheritable Class AssociationAttribute
    Inherits Attribute

Remarks

Apply this attribute to both properties at the ends of the association, specifying an object relationship.

Examples

In the following sample code, the Location class might contain several Departments and each Department can in turn span several Locations.

using DevExpress.Xpo;
// ...
public class Location : XPObject {
    public string Name;
    [Association("Locations-Departments")]
    public XPCollection<Department> Departments { 
        get { return GetCollection<Department>("Departments"); }
    }
}
public class Department : XPObject {
    public string Name;
    [Association("Locations-Departments")]
    public XPCollection<Location> Locations { 
        get { return GetCollection<Location>("Locations"); } 
    }
}

Inheritance

Object
Attribute
AssociationAttribute

Implements

See Also