Creating tenants from script

Topics: Administration, Writing modules
Sep 29, 2012 at 1:02 PM


Has anyone tried to create tenants using some sort of automation ?

I have some custom modules that use external services and I'd like to see if there are any performance issues I should be worried about when running a couple hundred of tenants.

Sep 30, 2012 at 7:18 PM
Edited Sep 30, 2012 at 7:20 PM

I've ended up writing an admin module for this and as far as creating tenants it went rather smooth.
Now when I try to set up the tenants I get this nasty error:

[ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it has already been disposed.]
   Autofac.Core.Lifetime.LifetimeScope.CheckNotDisposed() +57
   Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +59

For setting up each tenant I use the following code:

for (int i = 0; i < viewModel.Count; i++)
        using (var environment = _orchardHost.CreateStandaloneEnvironment(tenant))
		ISetupService setupService = environment.Resolve<ISetupService>();
                using (var trans = new TransactionScope(TransactionScopeOption.Suppress))

I've noticed that in Local DTC all of my transaction are being aborted.
Could someone please advise me on this ?