/// <summary> /// 通过仓库类型查找指定的仓库。 /// </summary> /// <param name="repositoryType"></param> /// <returns></returns> public IRepositoryInternal Find(Type repositoryType) { var last = this._lastRepository; if (last != null && last.GetType() == repositoryType) { return(last); } EntityRepository result = null; if (!this._repoByType.TryGetValue(repositoryType, out result)) { lock (this._repoByType) { if (!this._repoByType.TryGetValue(repositoryType, out result)) { var matrix = EntityMatrix.FindByRepository(repositoryType); var entityType = matrix.EntityType; result = this.FindByEntity(entityType) as EntityRepository; this._repoByType.Add(repositoryType, result); } } } this._lastRepository = result; return(result); }
/// <summary> /// 查询实体类型组合 /// </summary> /// <returns></returns> private EntityMatrix GetConventionItemCore() { //if (this.RealEntityType != null) //{ // return EntityMatrix.FindByEntity(this.RealEntityType); //} //默认使用约定查询出实体类型组合 return(EntityMatrix.FindByRepository(this.GetType())); }