private static IDbContext Resolve(string organizationKey, DbContextList dbContextList) { var dbContext = dbContextList.FirstOrDefault(m => m.OrganizationKey == organizationKey) ?? dbContextList.FirstOrDefault(m => m.OrganizationKey == string.Empty); if (dbContext == null) { throw new ArgumentException($"{nameof(organizationKey)} '{organizationKey}' is unknown and no default existing."); } return(dbContext); }
/// <summary> /// Ctor. /// </summary> /// <param name="dbContextList"></param> public DbContextResolver(DbContextList dbContextList) { DbContextList = dbContextList; }