public ApiEntityTypeConfiguration <TEntityType> Entity <TEntityType>() where TEntityType : class { Type entityType = typeof(TEntityType); ApiEntityTypeConfiguration entityTypeConfig; if (!this.entityTypeConfigs.TryGetValue(entityType, out entityTypeConfig)) { EntityType dbEntityType; if (!this.dbEntityTypes.TryGetValue(entityType, out dbEntityType)) { throw new Exception(string.Format("There is no entity {0} in context {1}.", entityType, contextName)); } entityTypeConfig = new ApiEntityTypeConfiguration <TEntityType>(contextName, dbEntityType); this.entityTypeConfigs.Add(entityType, entityTypeConfig); } return((ApiEntityTypeConfiguration <TEntityType>)entityTypeConfig); }
internal bool TryGetEntityTypeConfig(Type type, out ApiEntityTypeConfiguration entityTypeConfig) { return(this.entityTypeConfigs.TryGetValue(type, out entityTypeConfig)); }