Пример #1
0
 public static ColumnIndexInfo WithInfoFromUniqueIndexAttribute(this ColumnIndexInfo indexInfo,
                                                                UniqueIndexAttribute attribute)
 {
     if (attribute != null)
     {
         indexInfo.IndexType = IndexType.UniqueIndex;
     }
     return(indexInfo);
 }
Пример #2
0
        public virtual UniqueIndex GenerateUniqueIndex(ITable table, UniqueIndexAttribute attribute)
        {
            if (attribute == null)
            {
                return(null);
            }

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

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

            return(result);
        }
Пример #3
0
        public virtual UniqueIndex GenerateUniqueIndex(ITable table, UniqueIndexAttribute attribute)
        {
            if (attribute == null)
                return null;

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

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

            return result;
        }