source/Nevermore/Mapping/DocumentMap.cs
/// <summary>
/// Defines a unique constraint. Nevermore will provide friendly error details if the unique constraint is violated.
/// </summary>
/// <param name="constraintName">The name of the constraint in SQL (or at least a partial match).</param>
/// <param name="columnNames">The name of the columns that the constraint relates to.</param>
/// <param name="errorMessage">An error message to put in the exception when the unique constraint is violated.</param>
/// <returns>A builder to further configure the unique constraint.</returns>
Defines a unique constraint. Nevermore will provide friendly error details if the unique constraint is violated.
Defines a unique constraint . Nevermore will provide friendly error details if the unique constraint is violated .
protected UniqueRule Unique(string constraintName, string[] columnNames, string errorMessage)
        {
            var unique = new UniqueRule(constraintName, columnNames) {Message = errorMessage};
            map.UniqueConstraints.Add(unique);
            return unique;
        }
protected UniqueRule Unique ( string constraintName , string [ ] columnNames , string errorMessage ) { var unique = new UniqueRule ( constraintName , columnNames ) { Message = errorMessage } ; map . UniqueConstraints . Add ( unique ) ; return unique ; }
Defines a unique constraint.
Defines a unique constraint .
A builder to further configure the unique constraint.
A builder to further configure the unique constraint .
constraintName
string
The name of the constraint in SQL (or at least a partial match).
The name of the constraint in SQL ( or at least a partial match ) .
columnNames
string[]
The name of the columns that the constraint relates to.
The name of the columns that the constraint relates to .
errorMessage
string
An error message to put in the exception when the unique constraint is violated.
An error message to put in the exception when the unique constraint is violated .