NPersistence Reference Guide
Specifies that a unique constraint should be placed on the column or group of columns.

Examples

CopyC#
Example 1:
2 different unique constraints for the 2 columns
[Unique]
public String getName() { return name; }

[Unique]
public String getDescription() { return description; }

Example 2:
Both columns included in one unique constraint.
[Unique(Name="uq1")]
public String getName() { return name; }

[Unique(Name="uq1")]
public String getDescription() { return description; }

Example 3:
The Unique annotation is defined at the Entity level
[Unique(Name="ix1", Members=new String[]{"name", "description"})]
[Entity]
public class Person
...
public String getName() { return name; }
public String getDescription() { return description; }

Namespace: NPersistence.Ext
Assembly: NPersistence (in NPersistence.dll) Version: 2.0.0.0 (2.0.0.0)

Syntax

   
 C# 
public sealed class Unique : Attribute

Members

         
 All Members  Constructors   Fields  
 Public

 Protected
 Instance

 Static 
 Declared

 Inherited
 XNA Framework Only 

 .NET Compact Framework Only 

 MemberDescription
Unique()()()()
Initializes a new instance of the Unique class
Members
Member names that compose this unique constraint. Relevant only when the Unique annotation is used on a class. Returns: member names that compose this unique constraint.
Name
(Optional) Name of the unique constraint, if not specified defaults to a generated unique constraint name given by the vendor. Default value: ""

Inheritance Hierarchy

System..::..Object
  System..::..Attribute
    NPersistence.Ext..::..Unique

See Also