NPersistence Reference Guide
Assembly: NPersistence (in NPersistence.dll) Version: 2.0.0.0 (2.0.0.0)
Specifies that a unique constraint is to be included in
the generated DDL for a primary or secondary table.
Namespace: NPersistenceExamples
CopyC#
Example: [Entity] [Table(Name="EMPLOYEE") ] [UniqueConstraint(TableRef = "EMPLOYEE", columnNames={"EMP_ID", "EMP_NAME"})] ) public class Employee { ... }
Examples
CopyC#
Example2: [JoinTable(name="CUST_PHONE")] [JoinColumn(AttributeRef="CUST_PHONE",name="CUST_ID", referencedColumnName="ID")] [JoinColumn(AttributeRef="CUST_PHONE",name="PHONE_ID", referencedColumnName="ID", Inverse=true)] [UniqueConstraint(TableRef = "CUST_PHONE", ColumnNames = new String[] { "CUST_ID", "PHONE_ID" })] )
Assembly: NPersistence (in NPersistence.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax
C# |
public sealed class UniqueConstraint : Attribute
Members
All Members | Constructors | Fields |
Public Protected | Instance Static | Declared Inherited | XNA Framework Only .NET Compact Framework Only |
Member | Description | |
---|---|---|
UniqueConstraint()()()() | Initializes a new instance of the UniqueConstraint class | |
ColumnNames | (Required) An array of the column names that make up the constraint
| |
Name | (Optional) Constraint name. A provider-chosen name will be chosen
if a name is not specified.
| |
TableRef |
(Required) Specifies the Table, JoinTable, SecondaryTable or TableGenerator attribute which this UniqueConstraint attribute belongs to.
This Unique constraint represents a Unique constraint that is to be placed on
the table. it is only used if table generation is in
effect. the constraint applys in addition to any constraints
specified by the Column and JoinColumn
annotations and constraints entailed by primary key mappings.
Defaults to no additional constraints
|
Inheritance Hierarchy
System..::..Object
System..::..Attribute
NPersistence..::..UniqueConstraint
System..::..Attribute
NPersistence..::..UniqueConstraint