--HG--
branch : dev
This commit is contained in:
Dave Reed
2010-11-17 14:55:03 -08:00
7 changed files with 0 additions and 144 deletions

View File

@@ -1,14 +0,0 @@
using Orchard.Localization;
using Orchard.UI.Navigation;
namespace Orchard.Migrations {
public class AdminMenu : INavigationProvider {
public Localizer T { get; set; }
public string MenuName { get { return "admin"; } }
public void GetNavigation(NavigationBuilder builder) {
builder.Add(T("Developer"), "1",
menu => menu.Add(T("Migration"), "1.0", item => item.Action("Index", "DatabaseUpdate", new { area = "Orchard.Migrations" })));
}
}
}

View File

@@ -1,40 +0,0 @@
using System;
using System.Web.Mvc;
using Orchard.Data.Migration.Generator;
using Orchard.Environment.Extensions;
using Orchard.Localization;
using Orchard.UI.Admin;
using Orchard.UI.Notify;
namespace Orchard.Migrations.Controllers {
[ValidateInput(false)]
[Admin, OrchardFeature("DatabaseUpdate")]
public class DatabaseUpdateController : Controller {
private readonly ISchemaCommandGenerator _schemaCommandGenerator;
public DatabaseUpdateController(ISchemaCommandGenerator schemaCommandGenerator, IOrchardServices orchardServices) {
_schemaCommandGenerator = schemaCommandGenerator;
Services = orchardServices;
}
public IOrchardServices Services { get; set; }
public Localizer T { get; set; }
public ActionResult Index() {
return View();
}
public ActionResult UpdateDatabase() {
try {
_schemaCommandGenerator.UpdateDatabase();
Services.Notifier.Information(T("Database updated successfuly"));
}
catch (Exception ex) {
Services.Notifier.Error(T("An error occured while updating the database: {0}", ex.Message));
}
return RedirectToAction("Index");
}
}
}

View File

@@ -9,7 +9,3 @@ Features:
Orchard.Migrations:
Description: Data migration commands.
Category: Developer
DatabaseUpdate:
Description: Automatically updates database schema.
Dependencies: Orchard.Migrations
Category: Developer

View File

@@ -69,16 +69,11 @@
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<Compile Include="AdminMenu.cs" />
<Compile Include="Controllers\DatabaseUpdateController.cs" />
<Compile Include="Commands\DataMigrationCommands.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Routes.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Module.txt" />
<Content Include="Views\DatabaseUpdate\Index.cshtml" />
<Content Include="Views\Web.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>

View File

@@ -1,47 +0,0 @@
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using Orchard.Mvc.Routes;
namespace Orchard.Migrations {
public class Routes : IRouteProvider {
public void GetRoutes(ICollection<RouteDescriptor> routes) {
foreach (var routeDescriptor in GetRoutes())
routes.Add(routeDescriptor);
}
public IEnumerable<RouteDescriptor> GetRoutes() {
return new[] {
new RouteDescriptor {
Route = new Route(
"Admin/Migrations/",
new RouteValueDictionary {
{"area", "Orchard.Migrations"},
{"controller", "DatabaseUpdate"},
{"action", "Index"}
},
new RouteValueDictionary(),
new RouteValueDictionary {
{"area", "Orchard.Migrations"}
},
new MvcRouteHandler())
},
new RouteDescriptor {
Route = new Route(
"Admin/Migrations/UpdateDatabase",
new RouteValueDictionary {
{"area", "Orchard.Migrations"},
{"controller", "DatabaseUpdate"},
{"action", "UpdateDatabase"}
},
new RouteValueDictionary(),
new RouteValueDictionary {
{"area", "Orchard.Migrations"}
},
new MvcRouteHandler())
}
};
}
}
}

View File

@@ -1,2 +0,0 @@
<h1>@Html.TitleForPage(T("Data Migration").ToString())</h1>
<p>@Html.ActionLink(T("Update Database").ToString(), "UpdateDatabase", "DatabaseUpdate")</p>

View File

@@ -1,32 +0,0 @@
<?xml version="1.0"?>
<configuration>
<system.web>
<httpHandlers>
</httpHandlers>
<!--
Enabling request validation in view pages would cause validation to occur
after the input has already been processed by the controller. By default
MVC performs request validation before a controller processes the input.
To change this behavior apply the ValidateInputAttribute to a
controller or action.
-->
<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
</handlers>
</system.webServer>
</configuration>