示例#1
0
        /// <summary>
        /// 生成主键条件
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="pkValues"></param>
        /// <returns></returns>
        internal static WhereOperation GetPrimaryKeyWhere<TEntity>(Array pkValues)//params object[] pkValues  
            where TEntity : Entity
        {
            WhereOperation where = new WhereOperation();
            Field[] keyfields = EntityCache.GetPrimaryKeyFields<TEntity>();

            if (keyfields == null)
                return where;

            Check.Require(keyfields.Length == pkValues.Length, "主键列与主键值无法对应!");

            int index = keyfields.Length;
            for (int i = 0; i < index; i++)
            {
                where = where.And(new WhereOperation(keyfields[i], pkValues.GetValue(i), QueryOperator.Equal));
            }
            return where;
        }
示例#2
0
文件: Field.cs 项目: yswenli/WEF
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="fileName">字段名</param>
 public Field(string fileName) : base(fileName, EntityCache.GetTableName <T>())
 {
 }