Beispiel #1
0
 public static ColumnIndexInfo WithInfoFromUniqueIndexAttribute(this ColumnIndexInfo indexInfo,
                                                                UniqueIndexAttribute attribute)
 {
     if (attribute != null)
     {
         indexInfo.IndexType = IndexType.UniqueIndex;
     }
     return(indexInfo);
 }
Beispiel #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);
        }
        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;
        }