mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Fixing Drop Index command for SqlCe
--HG-- branch : 1.x
This commit is contained in:
@@ -47,6 +47,7 @@ namespace Orchard.Tests.DataMigration {
|
|||||||
builder.RegisterType<DataServicesProviderFactory>().As<IDataServicesProviderFactory>();
|
builder.RegisterType<DataServicesProviderFactory>().As<IDataServicesProviderFactory>();
|
||||||
builder.RegisterType<StubReportsCoordinator>().As<IReportsCoordinator>();
|
builder.RegisterType<StubReportsCoordinator>().As<IReportsCoordinator>();
|
||||||
builder.RegisterType<DefaultDataMigrationInterpreter>().As<IDataMigrationInterpreter>();
|
builder.RegisterType<DefaultDataMigrationInterpreter>().As<IDataMigrationInterpreter>();
|
||||||
|
builder.RegisterType<SqlCeCommandInterpreter>().As<ICommandInterpreter>();
|
||||||
builder.RegisterType<SessionConfigurationCache>().As<ISessionConfigurationCache>();
|
builder.RegisterType<SessionConfigurationCache>().As<ISessionConfigurationCache>();
|
||||||
builder.RegisterType<SessionFactoryHolder>().As<ISessionFactoryHolder>();
|
builder.RegisterType<SessionFactoryHolder>().As<ISessionFactoryHolder>();
|
||||||
builder.RegisterType<DefaultDatabaseCacheConfiguration>().As<IDatabaseCacheConfiguration>();
|
builder.RegisterType<DefaultDatabaseCacheConfiguration>().As<IDatabaseCacheConfiguration>();
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using NHibernate.Dialect;
|
||||||
|
using Orchard.Data.Migration.Schema;
|
||||||
|
using Orchard.Environment.Configuration;
|
||||||
|
|
||||||
|
namespace Orchard.Data.Migration.Interpreters {
|
||||||
|
public class SqlCeCommandInterpreter : ICommandInterpreter<DropIndexCommand> {
|
||||||
|
private readonly Dialect _dialect;
|
||||||
|
private readonly ShellSettings _shellSettings;
|
||||||
|
|
||||||
|
public string DataProvider {
|
||||||
|
get { return "SqlCe"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public SqlCeCommandInterpreter(
|
||||||
|
ShellSettings shellSettings,
|
||||||
|
ISessionFactoryHolder sessionFactoryHolder) {
|
||||||
|
_shellSettings = shellSettings;
|
||||||
|
var configuration = sessionFactoryHolder.GetConfiguration();
|
||||||
|
_dialect = Dialect.GetDialect(configuration.Properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string[] CreateStatements(DropIndexCommand command) {
|
||||||
|
|
||||||
|
return new [] { String.Format("drop index {0}.{1}",
|
||||||
|
_dialect.QuoteForTableName(PrefixTableName(command.TableName)),
|
||||||
|
_dialect.QuoteForColumnName(PrefixTableName(command.IndexName)))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private string PrefixTableName(string tableName) {
|
||||||
|
if (string.IsNullOrEmpty(_shellSettings.DataTablePrefix))
|
||||||
|
return tableName;
|
||||||
|
return _shellSettings.DataTablePrefix + "_" + tableName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -178,6 +178,7 @@
|
|||||||
<Compile Include="Data\DefaultDatabaseCacheConfiguration.cs" />
|
<Compile Include="Data\DefaultDatabaseCacheConfiguration.cs" />
|
||||||
<Compile Include="Data\IDatabaseCacheConfiguration.cs" />
|
<Compile Include="Data\IDatabaseCacheConfiguration.cs" />
|
||||||
<Compile Include="Data\Migration\AutomaticDataMigrations.cs" />
|
<Compile Include="Data\Migration\AutomaticDataMigrations.cs" />
|
||||||
|
<Compile Include="Data\Migration\Interpreters\SqlCeCommandInterpreter.cs" />
|
||||||
<Compile Include="DisplayManagement\Descriptors\PlacementInfo.cs" />
|
<Compile Include="DisplayManagement\Descriptors\PlacementInfo.cs" />
|
||||||
<Compile Include="DisplayManagement\Descriptors\ResourceBindingStrategy\StylesheetBindingStrategy.cs" />
|
<Compile Include="DisplayManagement\Descriptors\ResourceBindingStrategy\StylesheetBindingStrategy.cs" />
|
||||||
<Compile Include="DisplayManagement\Descriptors\ShapeDescriptor.cs" />
|
<Compile Include="DisplayManagement\Descriptors\ShapeDescriptor.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user