title: Autofac Multi-Tenant ASP.NET Application return the tenant instead of the identifier
body: <p>I am using Autofac as a IoC container with <a href="http://docs.autofac.org/en/latest/advanced/multitenant.html#" rel="nofollow noreferrer"><code>Autofac.Multitenant</code></a> package for multi-tenancy.</p>
  
  <p>I have a container setup like this:</p>
  
  <pre><code>var builder = new ContainerBuilder();
  
  // Register the controllers    
  builder.RegisterControllers(typeof(Deskful.Web.DeskfulApplication).Assembly);
  
  // Tenant Identifier
  var tenantIdentifier = new RequestSubdomainStrategy();
  
  builder.RegisterInstance(tenantIdentifier).As&lt;ITenantIdentificationStrategy&gt;();
  
  // Build container
  var container = builder.Build();
  
  // Tenant container
  var mtc = new MultitenantContainer(tenantIdentifier, container);
  
  // Set autofac as dependency resolver
  DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
  </code></pre>
  
  <p>And my identification strategy:</p>
  
  <pre><code>public class RequestSubdomainStrategy : ITenantIdentificationStrategy
  {
      public bool TryIdentifyTenant(out object tenantId)
      {
          tenantId = null;
  
          try
          {
              var context = HttpContext.Current;
              if (context != null &amp;&amp; context.Request != null)
              {
                  var site = context.Request.Url.Host;
  
                  tenantId = 1;
              }
          }
          catch { }
  
          return tenantId != null;
      }
  }
  </code></pre>
  
  <p>Then in my controller where I need the tenant I can do the following after injecting the <code>ITenantIdentificationStrategy</code>:</p>
  
  <pre><code>var tenantId = this.TenantIdStrategy.IdentifyTenant&lt;int&gt;();
  </code></pre>
  
  <p>My question is, how can I store the tenant object during my identification process so I can access all the properties of the tenant?</p>
  
  <p>Because now it only returns the id.</p>