Skip to content

Instantly share code, notes, and snippets.

@knepe
Last active September 30, 2018 22:51
Show Gist options
  • Save knepe/1bd885d1764b533356c7c133022e39a4 to your computer and use it in GitHub Desktop.
Save knepe/1bd885d1764b533356c7c133022e39a4 to your computer and use it in GitHub Desktop.
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddXXX()
....
services.AddMultiTenancy<AppTenant>((multiTenancyOptions) =>
{
multiTenancyOptions
.DistinguishTenantsWith<HeaderTenantDistinguisherFactory>()
.InitialiseTenant<TenantShellFactory>()
.ConfigureTenantContainers((containerBuilder) =>
{
containerBuilder.WithStructureMap((tenant, tenantServices) =>
{
//add a bunch of tenant services
});
});
});
var container = new Container();
container.Configure(config =>
{
config.Populate(services);
// add generic services
});
return container.GetInstance<IServiceProvider>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment