コード例 #1
0
        public static void CreateConstraint(this IAlterProcessor proc, ConstraintInfo cnt)
        {
            var pk = cnt as PrimaryKeyInfo;

            if (pk != null)
            {
                proc.CreatePrimaryKey(pk);
            }
            var fk = cnt as ForeignKeyInfo;

            if (fk != null)
            {
                proc.CreateForeignKey(fk);
            }
            var uq = cnt as UniqueInfo;

            if (uq != null)
            {
                proc.CreateUnique(uq);
            }
            var ix = cnt as IndexInfo;

            if (ix != null)
            {
                proc.CreateIndex(ix);
            }
            var ch = cnt as CheckInfo;

            if (ch != null)
            {
                proc.CreateCheck(ch);
            }
        }