mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 20:13:50 +08:00
Changing namespace of Migrations to Builders
Refactoring to be what's needed at the moment --HG-- branch : dev
This commit is contained in:
@@ -7,7 +7,7 @@ using Autofac.Builder;
|
||||
using JetBrains.Annotations;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Data.Migrations;
|
||||
using Orchard.Data.Builders;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Setup.Controllers;
|
||||
|
@@ -1,13 +1,13 @@
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Data.Migrations;
|
||||
using Orchard.Data.Builders;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Tests.Records;
|
||||
|
||||
namespace Orchard.Tests.Data.Migrations {
|
||||
namespace Orchard.Tests.Data.Builders {
|
||||
[TestFixture]
|
||||
public class DatabaseManagerTests {
|
||||
public class SessionFactoryBuilderTests {
|
||||
private string _tempDataFolder;
|
||||
|
||||
[SetUp]
|
||||
@@ -47,16 +47,16 @@ namespace Orchard.Tests.Data.Migrations {
|
||||
|
||||
[Test]
|
||||
public void SQLiteSchemaShouldBeGeneratedAndUsable() {
|
||||
var recordDescriptors = new[] {
|
||||
new RecordDescriptor {Prefix = "Hello", Type = typeof (Foo)}
|
||||
};
|
||||
var recordDescriptors = new[] {
|
||||
new RecordDescriptor {Prefix = "Hello", Type = typeof (Foo)}
|
||||
};
|
||||
var manager = (ISessionFactoryBuilder)new SessionFactoryBuilder();
|
||||
var sessionFactory = manager.BuildSessionFactory(new SessionFactoryParameters {
|
||||
Provider = "SQLite",
|
||||
DataFolder = _tempDataFolder,
|
||||
UpdateSchema = true,
|
||||
RecordDescriptors = recordDescriptors
|
||||
});
|
||||
Provider = "SQLite",
|
||||
DataFolder = _tempDataFolder,
|
||||
UpdateSchema = true,
|
||||
RecordDescriptors = recordDescriptors
|
||||
});
|
||||
|
||||
|
||||
var session = sessionFactory.OpenSession();
|
||||
@@ -77,17 +77,17 @@ namespace Orchard.Tests.Data.Migrations {
|
||||
CreateSqlServerDatabase(databasePath);
|
||||
|
||||
var recordDescriptors = new[] {
|
||||
new RecordDescriptor {Prefix = "Hello", Type = typeof (Foo)}
|
||||
};
|
||||
new RecordDescriptor {Prefix = "Hello", Type = typeof (Foo)}
|
||||
};
|
||||
|
||||
var manager = (ISessionFactoryBuilder)new SessionFactoryBuilder();
|
||||
var sessionFactory = manager.BuildSessionFactory(new SessionFactoryParameters {
|
||||
Provider = "SQLite",
|
||||
DataFolder = _tempDataFolder,
|
||||
ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFileName=" + databasePath + ";Integrated Security=True;User Instance=True;",
|
||||
UpdateSchema = true,
|
||||
RecordDescriptors = recordDescriptors,
|
||||
});
|
||||
Provider = "SQLite",
|
||||
DataFolder = _tempDataFolder,
|
||||
ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFileName=" + databasePath + ";Integrated Security=True;User Instance=True;",
|
||||
UpdateSchema = true,
|
||||
RecordDescriptors = recordDescriptors,
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -102,4 +102,4 @@ namespace Orchard.Tests.Data.Migrations {
|
||||
sessionFactory.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -9,7 +9,7 @@ using FluentNHibernate.Cfg.Db;
|
||||
using NHibernate;
|
||||
using NHibernate.Tool.hbm2ddl;
|
||||
using Orchard.Data;
|
||||
using Orchard.Data.Migrations;
|
||||
using Orchard.Data.Builders;
|
||||
using Orchard.Environment;
|
||||
|
||||
namespace Orchard.Tests {
|
||||
|
@@ -135,7 +135,7 @@
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DataUtility.cs" />
|
||||
<Compile Include="Data\Migrations\DatabaseManagerTests.cs" />
|
||||
<Compile Include="Data\Builders\SessionFactoryBuilderTests.cs" />
|
||||
<Compile Include="Data\RepositoryTests.cs" />
|
||||
<Compile Include="Data\StubLocator.cs" />
|
||||
<Compile Include="Environment\Configuration\AppDataFolderTests.cs" />
|
||||
|
@@ -13,7 +13,7 @@
|
||||
<add name="WebPageTrace"/>
|
||||
</listeners>
|
||||
</source>
|
||||
<source name="Orchard.Localization" switchValue="Information">
|
||||
<source name="Orchard.Data.SessionLocator" switchValue="Information">
|
||||
<listeners>
|
||||
<add name="OrchardDebugTextLog" />
|
||||
<add name="WebPageTrace"/>
|
||||
|
@@ -7,7 +7,7 @@ using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
using Orchard.Core.Settings.Models;
|
||||
using Orchard.Data;
|
||||
using Orchard.Data.Migrations;
|
||||
using Orchard.Data.Builders;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Security;
|
||||
|
@@ -13,7 +13,7 @@ using Orchard.ContentManagement.Records;
|
||||
using Orchard.Data.Conventions;
|
||||
using Orchard.Environment;
|
||||
|
||||
namespace Orchard.Data.Migrations {
|
||||
namespace Orchard.Data.Builders {
|
||||
public abstract class AbstractBuilder {
|
||||
protected abstract IPersistenceConfigurer GetPersistenceConfigurer();
|
||||
|
@@ -2,7 +2,7 @@ using System.Collections.Generic;
|
||||
using NHibernate;
|
||||
using Orchard.Environment;
|
||||
|
||||
namespace Orchard.Data.Migrations {
|
||||
namespace Orchard.Data.Builders {
|
||||
|
||||
public interface ISessionFactoryBuilder : IDependency {
|
||||
ISessionFactory BuildSessionFactory(SessionFactoryParameters sessionFactoryParameters);
|
@@ -1,7 +1,7 @@
|
||||
using System.IO;
|
||||
using FluentNHibernate.Cfg.Db;
|
||||
|
||||
namespace Orchard.Data.Migrations {
|
||||
namespace Orchard.Data.Builders {
|
||||
public class SQLiteBuilder : AbstractBuilder {
|
||||
private readonly string _dataFolder;
|
||||
private readonly string _connectionString;
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using NHibernate;
|
||||
|
||||
namespace Orchard.Data.Migrations {
|
||||
namespace Orchard.Data.Builders {
|
||||
public class SessionFactoryBuilder : ISessionFactoryBuilder {
|
||||
public ISessionFactory BuildSessionFactory(SessionFactoryParameters sessionFactoryParameters) {
|
||||
AbstractBuilder builder;
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using FluentNHibernate.Cfg.Db;
|
||||
|
||||
namespace Orchard.Data.Migrations {
|
||||
namespace Orchard.Data.Builders {
|
||||
public class SqlServerBuilder : AbstractBuilder {
|
||||
private readonly string _dataFolder;
|
||||
private readonly string _connectionString;
|
@@ -1,6 +1,6 @@
|
||||
using System.IO;
|
||||
using NHibernate;
|
||||
using Orchard.Data.Migrations;
|
||||
using Orchard.Data.Builders;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Logging;
|
||||
|
@@ -8,7 +8,7 @@ using System.Web.Routing;
|
||||
using Autofac;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Data.Migrations;
|
||||
using Orchard.Data.Builders;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Extensions;
|
||||
using Orchard.Localization;
|
||||
|
@@ -133,11 +133,11 @@
|
||||
<Compile Include="ContentManagement\Handlers\RemoveContentContext.cs" />
|
||||
<Compile Include="ContentManagement\Handlers\VersionContentContext.cs" />
|
||||
<Compile Include="Data\Conventions\RecordTableNameConvention.cs" />
|
||||
<Compile Include="Data\Migrations\AbstractBuilder.cs" />
|
||||
<Compile Include="Data\Migrations\SessionFactoryBuilder.cs" />
|
||||
<Compile Include="Data\Migrations\ISessionFactoryBuilder.cs" />
|
||||
<Compile Include="Data\Migrations\SQLiteBuilder.cs" />
|
||||
<Compile Include="Data\Migrations\SqlServerBuilder.cs" />
|
||||
<Compile Include="Data\Builders\AbstractBuilder.cs" />
|
||||
<Compile Include="Data\Builders\SessionFactoryBuilder.cs" />
|
||||
<Compile Include="Data\Builders\ISessionFactoryBuilder.cs" />
|
||||
<Compile Include="Data\Builders\SQLiteBuilder.cs" />
|
||||
<Compile Include="Data\Builders\SqlServerBuilder.cs" />
|
||||
<Compile Include="Data\SessionFactoryHolder.cs" />
|
||||
<Compile Include="Environment\Configuration\AppDataFolder.cs" />
|
||||
<Compile Include="Environment\Configuration\ShellSettingsLoader.cs" />
|
||||
|
Reference in New Issue
Block a user