Пример #1
0
 public ConstraintDefinition SetPrimaryKey(string columnsNames, string keyName = null)
 {
     columnsNames.MustNotBeEmpty();
     if (keyName == null) keyName = "PK_" + _table.TableName.FilterEscape();
     PrimaryKey = new UniqueKeyConstraint {Name = keyName, Columns = columnsNames, IsPrimary = true};
     return PrimaryKey;
 }
Пример #2
0
 public ConstraintDefinition AddUnique(string columns, string name = null)
 {
     columns.MustNotBeEmpty();
     if (name == null) name = GenerateIndexName(columns);
     var uc = new UniqueKeyConstraint {Name = name, Columns = columns};
     Uniques.Add(uc);
     return uc;
 }
Пример #3
0
 public ConstraintDefinition SetPrimaryKey(string columnsNames, string keyName = null)
 {
     columnsNames.MustNotBeEmpty();
     if (keyName == null)
     {
         keyName = "PK_" + _table.TableName.FilterEscape();
     }
     PrimaryKey = new UniqueKeyConstraint {
         Name = keyName, Columns = columnsNames, IsPrimary = true
     };
     return(PrimaryKey);
 }
Пример #4
0
        public ConstraintDefinition AddUnique(string columns, string name = null)
        {
            columns.MustNotBeEmpty();
            if (name == null)
            {
                name = GenerateIndexName(columns);
            }
            var uc = new UniqueKeyConstraint {
                Name = name, Columns = columns
            };

            Uniques.Add(uc);
            return(uc);
        }
Пример #5
0
 public virtual void Write(UniqueKeyConstraint constraint)
 {
     base.Write(constraint);
 }
Пример #6
0
 public UniqueKeyWriterTests()
 {
     _sb = new StringBuilder();
     _key = new UniqueKeyConstraint() {Columns = "id, user name",Name = "PK_Id",IsPrimary = true};
     _writer = new SqlServerUniqueKeyWriter(_sb);
 }