Updated code to reflect new DataServicesProvider changes

--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2010-06-25 17:06:02 -07:00
parent 8372db9457
commit a09536a44a
3 changed files with 17 additions and 4 deletions

View File

@@ -19,6 +19,8 @@ using Orchard.Security;
using Orchard.Settings;
using Orchard.Themes;
using Orchard.UI.Notify;
using Orchard.Environment.State;
using Orchard.DataMigration;
namespace Orchard.Setup.Services {
public class SetupService : ISetupService {
@@ -27,6 +29,8 @@ namespace Orchard.Setup.Services {
private readonly IShellSettingsManager _shellSettingsManager;
private readonly IShellContainerFactory _shellContainerFactory;
private readonly ICompositionStrategy _compositionStrategy;
private readonly IProcessingEngine _processingEngine;
private readonly IDataMigrationManager _dataMigrationManager;
public SetupService(
ShellSettings shellSettings,
@@ -34,12 +38,16 @@ namespace Orchard.Setup.Services {
IOrchardHost orchardHost,
IShellSettingsManager shellSettingsManager,
IShellContainerFactory shellContainerFactory,
ICompositionStrategy compositionStrategy) {
ICompositionStrategy compositionStrategy,
IProcessingEngine processingEngine,
IDataMigrationManager dataMigrationManager) {
_shellSettings = shellSettings;
_orchardHost = orchardHost;
_shellSettingsManager = shellSettingsManager;
_shellContainerFactory = shellContainerFactory;
_compositionStrategy = compositionStrategy;
_processingEngine = processingEngine;
_dataMigrationManager = dataMigrationManager;
T = NullLocalizer.Instance;
}
@@ -97,7 +105,7 @@ namespace Orchard.Setup.Services {
// initialize database explicitly, and store shell descriptor
var bootstrapLifetimeScope = _shellContainerFactory.CreateContainer(shellSettings, shellToplogy);
using (var environment = new StandaloneEnvironment(bootstrapLifetimeScope)) {
environment.Resolve<ISessionFactoryHolder>().CreateDatabase();
_dataMigrationManager.Update(new [] { "Orchard.Framework", "Settings" });
environment.Resolve<IShellDescriptorManager>().UpdateShellDescriptor(
0,
@@ -105,6 +113,10 @@ namespace Orchard.Setup.Services {
shellDescriptor.Parameters);
}
// in effect "pump messages" see PostMessage circa 1980
while ( _processingEngine.AreTasksPending() )
_processingEngine.ExecuteNextTask();
// creating a standalone environment.
// in theory this environment can be used to resolve any normal components by interface, and those

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using FluentNHibernate.Cfg;
using Orchard.Data.Builders;
using Orchard.Data.Providers;
using Orchard.DataMigration.Schema;
using Orchard.Environment.ShellBuilders.Models;
@@ -10,7 +10,7 @@ namespace Orchard.DataMigration {
public IEnumerable<ISchemaBuilderCommand> CreateCommands(IEnumerable<RecordBlueprint> records) {
// use FluentNhibernate generation for this module
var persistenceModel = AbstractBuilder.CreatePersistenceModel(records);
var persistenceModel = AbstractDataServicesProvider.CreatePersistenceModel(records);
var configuration = Fluently.Configure().Mappings(m => m.AutoMappings.Add(persistenceModel));
return Enumerable.Empty<ISchemaBuilderCommand>();

View File

@@ -356,6 +356,7 @@
<Compile Include="ContentManagement\ViewModels\TemplateViewModel.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="DataMigration\AutomaticDataMigration.cs" />
<Compile Include="DataMigration\Interpreters\ICommandInterpreter.cs" />
<Compile Include="DataMigration\Interpreters\DefaultDataMigrationInterpreter.cs" />
<Compile Include="DataMigration\Interpreters\IDataMigrationInterpreter.cs" />