mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Correcting data migration code generation
- Changing class name to Migrations.cs for consistency - Corrected project alteration to add the correct file path - Added missing using for System.Data --HG-- branch : dev
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
@@ -7,7 +8,7 @@ using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace $$FeatureName$$.DataMigrations {
|
||||
public class Migration : DataMigrationImpl {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
$$Commands$$
|
||||
|
@@ -61,7 +61,7 @@ namespace Orchard.CodeGeneration.Commands {
|
||||
}
|
||||
|
||||
string dataMigrationFolderPath = HostingEnvironment.MapPath("~/Modules/" + extensionDescriptor.Name + "/");
|
||||
string dataMigrationFilePath = dataMigrationFolderPath + "Migration.cs";
|
||||
string dataMigrationFilePath = dataMigrationFolderPath + "Migrations.cs";
|
||||
string templatesPath = HostingEnvironment.MapPath("~/Modules/Orchard." + ModuleName + "/CodeGenerationTemplates/");
|
||||
string moduleCsProjPath = HostingEnvironment.MapPath(string.Format("~/Modules/{0}/{0}.csproj", extensionDescriptor.Name));
|
||||
|
||||
@@ -93,11 +93,11 @@ namespace Orchard.CodeGeneration.Commands {
|
||||
|
||||
// The string searches in solution/project files can be made aware of comment lines.
|
||||
if ( projectFileText.Contains("<Compile Include") ) {
|
||||
string compileReference = string.Format("<Compile Include=\"{0}\" />\r\n ", "DataMigrations\\" + extensionDescriptor.DisplayName + "DataMigration.cs");
|
||||
string compileReference = string.Format("<Compile Include=\"{0}\" />\r\n ", "Migrations.cs");
|
||||
projectFileText = projectFileText.Insert(projectFileText.LastIndexOf("<Compile Include"), compileReference);
|
||||
}
|
||||
else {
|
||||
string itemGroupReference = string.Format("</ItemGroup>\r\n <ItemGroup>\r\n <Compile Include=\"{0}\" />\r\n ", "DataMigrations\\" + extensionDescriptor.DisplayName + "DataMigration.cs");
|
||||
string itemGroupReference = string.Format("</ItemGroup>\r\n <ItemGroup>\r\n <Compile Include=\"{0}\" />\r\n ", "Migrations.cs");
|
||||
projectFileText = projectFileText.Insert(projectFileText.LastIndexOf("</ItemGroup>"), itemGroupReference);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user