Exemplo n.º 1
0
            public SourceEnvironmentToTenantMap(EnvironmentResource[] environmentsToMigrate, TenantResource[] existingTenants)
            {
                var expectedTenantNames = environmentsToMigrate.Select(Conventions.BuildTenantNameFromSourceEnvironment).Distinct(StringComparer.OrdinalIgnoreCase).ToArray();
                var tenants             = existingTenants.Where(t => expectedTenantNames.Contains(t.Name, StringComparer.OrdinalIgnoreCase)).ToArray();

                MissingTenantNames = expectedTenantNames.Except(tenants.Select(t => t.Name), StringComparer.OrdinalIgnoreCase).ToArray();
                if (!MissingTenantNames.Any())
                {
                    sourcesAndTenants = environmentsToMigrate
                                        .Select(e => new SourceEnvironmentAndTenant(e, tenants.Single(t => string.Equals(t.Name, Conventions.BuildTenantNameFromSourceEnvironment(e), StringComparison.OrdinalIgnoreCase))))
                                        .ToArray();
                }
            }