コード例 #1
0
 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;
 }
コード例 #2
0
ファイル: DataIndexAttribute.cs プロジェクト: carbon/Data
        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;
        }
コード例 #3
0
ファイル: TableDef.cs プロジェクト: nQuantums/tips
 /// <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;
     }
 }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
 /// <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)
 {
 }
コード例 #6
0
 /// <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;
 }
コード例 #7
0
ファイル: IndexInfo.cs プロジェクト: carbon/Data
 public IndexInfo(IndexFlags flags, IList<MemberDescriptor> members)
 {
     Name = GetIndexName(members);
     Flags = flags;
     Members = members;
 }
コード例 #8
0
ファイル: IndexDefinition.cs プロジェクト: subTee/DSInternals
        /// <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;
        }