public Tenant GetTenantForRequest(string host) { // return a tenant directly from our host map Tenant t = null; lock (_hosts) { if (!_hosts.ContainsKey(host)) { _hosts[host] = _tenants.All().WithDocuments().FirstOrDefault(x => x.Match != null && x.Match.Any(y => 0 == String.Compare(host, y, true))); } t = _hosts[host]; } if (null == t) { throw new HttpException(404, "No tenant found for host '" + host + "'"); } return(t); }