Don't run background tasks in command-line host

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-07-19 11:18:57 -07:00
parent 3c6c58fa84
commit e180ce8b23
3 changed files with 12 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
using Orchard.Tasks;
namespace Orchard.Commands {
public class CommandBackgroundService : IBackgroundService {
public void Sweep() {
// Don't run any background service in command line
}
}
}

View File

@@ -9,6 +9,7 @@ using Orchard.Environment;
using Orchard.Environment.Configuration;
using Orchard.Localization;
using Orchard.Logging;
using Orchard.Tasks;
namespace Orchard.Commands {
/// <summary>
@@ -141,6 +142,7 @@ namespace Orchard.Commands {
protected void ContainerRegistrations(ContainerBuilder builder) {
MvcSingletons(builder);
builder.RegisterType<CommandHostEnvironment>().As<IHostEnvironment>();
builder.RegisterType<CommandBackgroundService>().As<IBackgroundService>();
}
protected void MvcSingletons(ContainerBuilder builder) {

View File

@@ -135,6 +135,7 @@
<Compile Include="Caching\Signals.cs" />
<Compile Include="Collections\IPageOfItems.cs" />
<Compile Include="Collections\PageOfItems.cs" />
<Compile Include="Commands\CommandBackgroundService.cs" />
<Compile Include="Commands\CommandHostEnvironment.cs" />
<Compile Include="ContentManagement\Aspects\ICommonAspect.cs">
<SubType>Code</SubType>