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+

NoForeignKeyAttribute Class

Disables automatic creation of the FOREIGN KEY constraints.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v19.1.dll

Declaration

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

Remarks

The following code demonstrates how to use the NoForeignKeyAttribute:


public class Person : XPObject
{
    // ...
    [Association("Person-Orders")]
    public XPCollection<Order> Orders {
        get { return GetCollection<Order>("Orders"); }
    }
}

public class Order : XPObject {
    // ...
    [Association("Person-Orders"), NoForeignKey]
    public Person PersonID;
}
Note

Foreign keys preserve referential integrity in a relational database. A lack of referential integrity in a database can lead to errors or returning incomplete data without indication of an error. To enforce the data integrity at the database level, do not disable automatic creation of the FOREIGN KEY constraints (or always add them manually).

Inheritance

Object
Attribute
NoForeignKeyAttribute
See Also