示例#1
0
        public UniqueTableIndex AddUniqueIndex(ITable table, Field[] fields)
        {
            var index = new UniqueTableIndex(table, TableIndex.GetColumnsFromFields(fields));

            AddIndex(index);
            return(index);
        }
示例#2
0
        public UniqueTableIndex AddUniqueIndex(ITable table, IColumn[] columns)
        {
            var index = new UniqueTableIndex(table, columns);

            AddIndex(index);
            return(index);
        }
示例#3
0
        public virtual UniqueTableIndex?GenerateUniqueIndex(ITable table, UniqueIndexAttribute?attribute)
        {
            if (attribute == null)
            {
                return(null);
            }

            var result = new UniqueTableIndex(table, TableIndex.GetColumnsFromFields(this))
            {
                AvoidAttachToUniqueIndexes = attribute.AvoidAttachToUniqueIndexes
            };

            if (attribute.AllowMultipleNulls)
            {
                result.Where = IndexWhereExpressionVisitor.IsNull(this, false);
            }

            return(result);
        }