Exposing table prefix information in SchemaBuilder.

Making DataMigrationImpl methods virtual for easier customization.

--HG--
branch : 1.x
This commit is contained in:
Piotr Szmyd
2013-05-07 23:31:46 +02:00
parent 7d6d384806
commit 65ae6c3400
2 changed files with 14 additions and 2 deletions

View File

@@ -7,8 +7,8 @@ namespace Orchard.Data.Migration {
/// Data Migration classes can inherit from this class to get a SchemaBuilder instance configured with the current tenant database prefix
/// </summary>
public abstract class DataMigrationImpl : IDataMigration {
public SchemaBuilder SchemaBuilder { get; set; }
public IContentDefinitionManager ContentDefinitionManager {get; set; }
public virtual SchemaBuilder SchemaBuilder { get; set; }
public virtual IContentDefinitionManager ContentDefinitionManager { get; set; }
public virtual Feature Feature { get; set; }
}
}

View File

@@ -13,6 +13,18 @@ namespace Orchard.Data.Migration.Schema {
_formatPrefix = formatPrefix ?? (s => s ?? String.Empty);
}
public IDataMigrationInterpreter Interpreter {
get { return _interpreter; }
}
public string FeaturePrefix {
get { return _featurePrefix; }
}
public Func<string, string> FormatPrefix {
get { return _formatPrefix; }
}
public SchemaBuilder CreateTable(string name, Action<CreateTableCommand> table) {
var createTable = new CreateTableCommand(String.Concat(_formatPrefix(_featurePrefix), name));
table(createTable);