/// <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; }
/// <summary> /// 构造函数 /// </summary> /// <param name="fileName">字段名</param> public Field(string fileName) : base(fileName, EntityCache.GetTableName <T>()) { }