public IndexConfig(IConfig config, IndexFlags flags, string identifier, ITableConfig table, IEnumerable <IColumnConfig> columns) : this(config) { this.Flags = flags; this.Identifier = identifier; this.Table = table; this.Columns = columns; }
public DataIndexAttribute(IndexFlags type, params string[] memberNames) { #region Preconditions if (memberNames.Length == 0) throw new ArgumentException("May not be empty", nameof(memberNames)); #endregion Type = type; Name = IndexHelper.GetName(memberNames); MemberNames = memberNames; }
/// <summary> /// インデックス定義を生成する /// </summary> /// <param name="flags">インデックスに設定するフラグ</param> /// <param name="getters"><see cref="Columns"/>のプロパティを呼び出す処理を指定する</param> /// <returns>インデックス定義</returns> protected virtual IIndexDef MakeIndex(IndexFlags flags, params Func <object>[] getters) { Mediator.Table = this; Mediator.TableName = this.Name; try { var colDefs = new IColumnDef[getters.Length]; for (int i = 0; i < getters.Length; i++) { colDefs[i] = Mediator.GetFrom(getters[i]); } return(new IndexDef(flags, colDefs)); } finally { Mediator.Table = null; Mediator.TableName = null; } }
/// <summary> /// Converts the <see cref="CreateIndexGrbit"/> enumeration to <see cref="IndexFlags"/>. /// </summary> /// <param name="grbitIndex">Index of the grbit.</param> /// <returns>The <see cref="IndexFlags"/> equivalent to <paramref name="grbitIndex"/>.</returns> private static IndexFlags IndexFlagsFromGrbits(CreateIndexGrbit grbitIndex) { IndexFlags flags = IndexFlags.None; if ((grbitIndex & CreateIndexGrbit.IndexUnique) != 0) { flags = flags | IndexFlags.Unique; } if ((grbitIndex & CreateIndexGrbit.IndexPrimary) != 0) { flags = flags | IndexFlags.Primary; } if ((grbitIndex & CreateIndexGrbit.IndexDisallowNull) != 0) { flags = flags | IndexFlags.DisallowNull; } if ((grbitIndex & CreateIndexGrbit.IndexIgnoreNull) != 0) { flags = flags | IndexFlags.IgnoreNull; } if ((grbitIndex & CreateIndexGrbit.IndexIgnoreAnyNull) != 0) { flags = flags | IndexFlags.IgnoreAnyNull; } if ((grbitIndex & CreateIndexGrbit.IndexSortNullsHigh) != 0) { flags = flags | IndexFlags.SortNullsHigh; } if ((grbitIndex & VistaGrbits.IndexDisallowTruncation) != 0) { flags = flags | IndexFlags.DisallowTruncation; } else { flags = flags | IndexFlags.AllowTruncation; } return(flags); }
/// <summary> /// コンストラクタ、全要素を指定して初期化する、インデックス名は自動生成される /// </summary> /// <param name="flags">インデックスのオプションフラグ</param> /// <param name="columns">インデックスを構成する列定義の配列</param> internal IndexDef(IndexFlags flags, params IColumnDef[] columns) : this($"idx_{Mediator.TableName}_{string.Join("_", from c in columns select c.Name)}", flags, columns) { }
/// <summary> /// コンストラクタ、全要素を指定して初期化する /// </summary> /// <param name="name">インデックス名</param> /// <param name="flags">インデックスのオプションフラグ</param> /// <param name="columns">インデックスを構成する列定義の配列</param> public IndexDef(string name, IndexFlags flags, params IColumnDef[] columns) { this.Name = name; this.Flags = flags; this.Columns = columns; }
public IndexInfo(IndexFlags flags, IList<MemberDescriptor> members) { Name = GetIndexName(members); Flags = flags; Members = members; }
/// <summary> /// Converts the <see cref="CreateIndexGrbit"/> enumeration to <see cref="IndexFlags"/>. /// </summary> /// <param name="grbitIndex">Index of the grbit.</param> /// <returns>The <see cref="IndexFlags"/> equivalent to <paramref name="grbitIndex"/>.</returns> private static IndexFlags IndexFlagsFromGrbits(CreateIndexGrbit grbitIndex) { IndexFlags flags = IndexFlags.None; if ((grbitIndex & CreateIndexGrbit.IndexUnique) != 0) { flags = flags | IndexFlags.Unique; } if ((grbitIndex & CreateIndexGrbit.IndexPrimary) != 0) { flags = flags | IndexFlags.Primary; } if ((grbitIndex & CreateIndexGrbit.IndexDisallowNull) != 0) { flags = flags | IndexFlags.DisallowNull; } if ((grbitIndex & CreateIndexGrbit.IndexIgnoreNull) != 0) { flags = flags | IndexFlags.IgnoreNull; } if ((grbitIndex & CreateIndexGrbit.IndexIgnoreAnyNull) != 0) { flags = flags | IndexFlags.IgnoreAnyNull; } if ((grbitIndex & CreateIndexGrbit.IndexSortNullsHigh) != 0) { flags = flags | IndexFlags.SortNullsHigh; } if ((grbitIndex & VistaGrbits.IndexDisallowTruncation) != 0) { flags = flags | IndexFlags.DisallowTruncation; } else { flags = flags | IndexFlags.AllowTruncation; } return flags; }