Removing MVC dependency on code generation

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2011-09-29 16:33:42 -07:00
parent 6a0e1d035f
commit 807b7d1333
4 changed files with 3 additions and 103 deletions

View File

@@ -1,98 +0,0 @@
<#@ template language="C#" HostSpecific="True" #>
<#
MvcTextTemplateHost mvcHost = (MvcTextTemplateHost)(Host);
#>
using System.Web.Mvc;
using Orchard.Localization;
using Orchard;
namespace <#= mvcHost.Namespace #>
{
public class <#= mvcHost.ControllerName #> : Controller
{
public IOrchardServices Services { get; set; }
public <#= mvcHost.ControllerName #>(IOrchardServices services) {
Services = services;
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
<#
if(mvcHost.AddActionMethods) {
#>
public ActionResult Index()
{
return View();
}
public ActionResult Details(int id)
{
return View();
}
public ActionResult Create()
{
return View();
}
[HttpPost]
public ActionResult Create(FormCollection collection)
{
try
{
// TODO: Add insert logic here
return RedirectToAction("Index");
}
catch
{
return View();
}
}
public ActionResult Edit(int id)
{
return View();
}
[HttpPost]
public ActionResult Edit(int id, FormCollection collection)
{
try
{
// TODO: Add update logic here
return RedirectToAction("Index");
}
catch
{
return View();
}
}
public ActionResult Delete(int id)
{
return View();
}
[HttpPost]
public ActionResult Delete(int id, FormCollection collection)
{
try
{
// TODO: Add delete logic here
return RedirectToAction("Index");
}
catch
{
return View();
}
}
<#
}
#>
}
}

View File

@@ -6,7 +6,7 @@
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{$$ModuleProjectGuid$$}</ProjectGuid>
<ProjectTypeGuids>{E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<ProjectTypeGuids>{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>$$ModuleName$$</RootNamespace>

View File

@@ -23,7 +23,7 @@ namespace Orchard.CodeGeneration.Commands {
"", "Content", "Styles", "Scripts", "Views", "Zones"
};
private static readonly string[] _moduleDirectories = new [] {
"", "Properties", "Controllers", "Views", "Models", "Scripts", "Styles", "CodeTemplates/AddController"
"", "Properties", "Controllers", "Views", "Models", "Scripts", "Styles"
};
private const string ModuleName = "CodeGeneration";

View File

@@ -14,6 +14,7 @@
<AssemblyName>Orchard.CodeGeneration</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>false</UseIISExpress>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -82,9 +83,6 @@
<ItemGroup>
<Content Include="CodeGenerationTemplates\Placement.info" />
</ItemGroup>
<ItemGroup>
<Content Include="CodeGenerationTemplates\Controller.tt" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.