public ICompilationContext Compile(ICommandContext context, ServiceArguments arguments, Guid behaviorId) { _container.EjectAllInstancesOf<ICommandContext>(); var container = _container.GetNestedContainer(); var command = new StructureMapContainerCommand(container, arguments, behaviorId); var compilationContext = new StructureMapCompilationContext(container, command); context.Set<ICompilationContext>(compilationContext); container.Configure(x => x.For<ICommandContext>().Use(context)); return compilationContext; }