/// <summary> /// 初始化类型 <see cref="EntityModel"/> 的新实例。 /// </summary> protected EntityModel() { this._entityType = this.GetType(); this._properties = EntityUtility.GetProperties(this._entityType).Where(p => p.GetMethod != null).ToArray(); this._propertyCache = new Dictionary <string, PropertyInfo>(); this._keySelectorCache = new Dictionary <string, Delegate>(); }
/// <summary> /// 获取 实体数据模型类型 中的所有主键组成的一个数组。如果该 实体数据模型类型 没有定义主键,则返回一个空数组。 /// </summary> /// <returns></returns> public virtual PropertyInfo[] GetPrimaryKeys() { return(EntityUtility.GetPrimaryKeys(this.GetType())); }
/// <summary> /// 获取 实体数据模型类型 中的所有主键的值组成的一个数组。如果该 实体数据模型类型 没有定义主键,则返回一个空数组。 /// </summary> /// <returns></returns> public virtual object[] GetPrimaryKeyValues() { return(EntityUtility.GetPrimaryKeyValues(this)); }
/// <summary> /// 获取 实体数据模型类型 中的所有主键的名称组成的一个数组。如果该 实体数据模型类型 没有定义主键,则返回一个空数组。 /// </summary> /// <returns></returns> public virtual string[] GetPrimaryKeyNames() { return(EntityUtility.GetPrimaryKeyNames(this.GetType())); }