コード例 #1
0
        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);
        }
コード例 #2
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="dbContextList"></param>
 public DbContextResolver(DbContextList dbContextList)
 {
     DbContextList = dbContextList;
 }