0
votes

Getting the following exception after trying to upgrade to the latest versions of AutoFac, MVC and WEB API

Additional information: Inheritance security rules violated by type: 'Autofac.Extras.Multitenant.MultitenantContainer'. Derived types must either match the security accessibility of the base type or be less accessible.

Multitenacy Code:

 var mcontainer = new MultitenantContainer(tenantIdentifier, container);
 mcontainer.ConfigureTenant("1", x => x.RegisterType<ProductX>().As<IProduct>().InstancePerTenant());

 mcontainer.ConfigureTenant("2", x => x.RegisterType<ProductY>().As<IProduct>().InstancePerTenant());

 DependencyResolver.SetResolver(new AutofacWebApiDependencyResolver(mcontainer));

This example is from http://autofac.readthedocs.org/en/latest/advanced/multitenant.html#asp-net-integration

Any suggestions on what I'm doing wrong? Our end goal is to setup our application to be configured through JSON.

Thanks in advance.

1

1 Answers

1
votes

For the Autofac 4.0 prereleases (which you're using if you're working with JSON configuration) the package was renamed from Autofac.Extras.Multitenant to Autofac.Multitenant.