コード例 #1
0
 public static ColumnIndexInfo WithInfoFromAbstractIndexAttribute(this ColumnIndexInfo indexInfo,
                                                                  AbstractIndexAttribute indexAttribute)
 {
     indexInfo.Order        = indexAttribute.Order;
     indexInfo.IsDescending = indexAttribute.IsDescending;
     return(indexInfo);
 }
コード例 #2
0
 public static ColumnIndexInfo WithInfoFromUniqueIndexAttribute(this ColumnIndexInfo indexInfo,
                                                                UniqueIndexAttribute attribute)
 {
     if (attribute != null)
     {
         indexInfo.IndexType = IndexType.UniqueIndex;
     }
     return(indexInfo);
 }
コード例 #3
0
        public static ColumnIndexInfo WithInfoFromFullTextIndexAttribute(this ColumnIndexInfo indexInfo,
                                                                         FullTextIndexAttribute indexAttribute)
        {
            if (indexAttribute == null)
            {
                return(indexInfo);
            }
            indexInfo.IndexType = IndexType.FullTextIndex;
            var tmp = indexInfo.FullTextCatalog ?? new FullTextCatalogInfo();

            tmp.Name = indexAttribute.FullTextCatalogName;
            indexInfo.FullTextCatalog = tmp;
            return(indexInfo);
        }
コード例 #4
0
        private static ColumnIndexInfo GetOrCreateColumnIndexInfo(ColumnInfo columnInfo,
                                                                  AbstractIndexAttribute indexAttribute)
        {
            var indexName = indexAttribute.Name?.Trim() ?? "";
            var indexInfo = columnInfo.ColumnIndexes.SingleOrDefault(a => a.IndexName == indexName);

            if (indexInfo != null)
            {
                return(indexInfo);
            }
            indexInfo = new ColumnIndexInfo
            {
                IndexName = indexName
            };
            columnInfo.ColumnIndexes.Add(indexInfo);
            return(indexInfo);
        }