mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Forcing the host to restart in specflow
This commit is contained in:
@@ -59,6 +59,11 @@ namespace Orchard.Specs.Bindings {
|
||||
descriptor.Features.Concat(new[] { new ShellFeature { Name = name } }),
|
||||
descriptor.Parameters);
|
||||
}
|
||||
|
||||
// this is needed to force the tenant to restart when a new feature is enabled,
|
||||
// as DefaultOrchardHost maintains this list in a thread context otherwise
|
||||
// and looses the information
|
||||
MvcApplication.RestartTenant("Default");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -40,14 +40,24 @@ namespace Orchard.Specs.Hosting.Orchard.Web {
|
||||
builder.Register(ctx => RouteTable.Routes).SingleInstance();
|
||||
builder.Register(ctx => ModelBinders.Binders).SingleInstance();
|
||||
builder.Register(ctx => ViewEngines.Engines).SingleInstance();
|
||||
|
||||
builder.RegisterType<SpecHostEnvironment>().As<IHostEnvironment>();
|
||||
}
|
||||
|
||||
public static void ReloadExtensions() {
|
||||
_host.ReloadExtensions();
|
||||
}
|
||||
|
||||
public static void RestartTenant(string name) {
|
||||
var settings = _container.Resolve<IShellSettingsManager>().LoadSettings().SingleOrDefault(x => x.Name == name);
|
||||
if (settings == null) {
|
||||
settings = new ShellSettings {
|
||||
Name = name,
|
||||
State = TenantState.Uninitialized
|
||||
};
|
||||
}
|
||||
|
||||
((DefaultOrchardHost)_host).ActivateShell(settings);
|
||||
}
|
||||
|
||||
public static IWorkContextScope CreateStandaloneEnvironment(string name) {
|
||||
var settings = _container.Resolve<IShellSettingsManager>().LoadSettings().SingleOrDefault(x => x.Name == name);
|
||||
if (settings == null) {
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using Orchard.Environment;
|
||||
|
||||
namespace Orchard.Specs.Hosting {
|
||||
public class SpecHostEnvironment : HostEnvironment {
|
||||
public SpecHostEnvironment() {
|
||||
}
|
||||
|
||||
public override void RestartAppDomain() {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,6 @@
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Hosting\SpecHostEnvironment.cs" />
|
||||
<Compile Include="Input.feature.cs">
|
||||
<DependentUpon>Input.feature</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
|
||||
Reference in New Issue
Block a user