Пример #1
0
        TenantId ResolveTenantIdForAllSegments(HostString host, HostnameStrategyResource configuration)
        {
            var tenantSegment = host.Host;

            if (!configuration.Map.ContainsKey(tenantSegment))
            {
                throw new CouldNotMapTenantSegmentToTenantId(tenantSegment);
            }
            return(configuration.Map[tenantSegment]);
        }
Пример #2
0
        TenantId ResolveTenantIdForFirstSegment(HostString host, HostnameStrategyResource configuration)
        {
            var segments = host.Host.Split(_hostnameSegmentSeparator);

            if (segments.Length < 1)
            {
                throw new CannotResolveTenantFromHostname(host.Host);
            }
            var tenantSegment = segments[0];

            if (!configuration.Map.ContainsKey(tenantSegment))
            {
                throw new CouldNotMapTenantSegmentToTenantId(tenantSegment);
            }
            return(configuration.Map[tenantSegment]);
        }