Set MvcBuildViews to true, add T4MVC (more MVCContrib might be used in the future)

This commit is contained in:
Christoph Wille 2010-05-12 13:05:15 +00:00
Родитель 465ec3ea26
Коммит cf10bc9bb0
6 изменённых файлов: 1525 добавлений и 2 удалений

Просмотреть файл

@ -0,0 +1,96 @@
<#+
/*
This file contains settings used by T4MVC.tt. The main goal is to avoid the need for users
to fork the 'official' template in order to achieve what they want.
*/
// The prefix used for things like MVC.Dinners.Name and MVC.Dinners.Delete(Model.DinnerID)
const string HelpersPrefix = "MVC";
// Namespaces to be referenced by the generated code
readonly string[] ReferencedNamespaces = new string[] {
};
// The folder under the project that contains the areas
const string AreasFolder = "Areas";
// Choose whether you want to include an 'Areas' token when referring to areas.
// e.g. Assume the Area is called Blog and the Controller is Post:
// - When false use MVC.Blog.Post.etc...
// - When true use MVC.Areas.Blog.Post.etc...
static bool IncludeAreasToken = false;
// The folder under the project that contains the controllers
const string ControllersFolder = "Controllers";
// The folder under the project that contains the views
const string ViewsRootFolder = "Views";
// The name of the interface that all T4MVC action results will implement
const string ActionResultInterfaceName = "IT4MVCActionResult";
// If true, the T4MVC action result interface will be generated
// If false, the namespace of the interface must be referenced in the 'ReferencedNamespaces' setting
const bool GenerateActionResultInterface = true;
// If true, use lower case tokens in routes for the area, controller and action names
const bool UseLowercaseRoutes = false;
// The namespace that the links are generated in (e.g. "Links", as in Links.Content.nerd_jpg)
const string LinksNamespace = "Links";
// If true, links to static files include a query string containing the file's last change time. This way,
// when the static file changes, the link changes and guarantees that the client will re-request the resource.
// e.g. when true, the link looks like: "/Content/nerd.jpg?2009-09-04T12:25:48"
const bool AddTimestampToStaticLinks = false;
// Folders containing static files for which links are generated (e.g. Links.Scripts.Map_js)
readonly string[] StaticFilesFolders = new string[] {
"Scripts",
"Content",
};
// Static files to exclude from the generated links
readonly string[] ExcludedStaticFileExtensions = new string[] {
".cs"
};
// If true, the template marks itself as unsaved as part of its execution.
// This way it will be saved and update itself next time the project is built.
// Basically, it keeps marking itself as unsaved to make the next build work.
// Note: this is certainly hacky, but is the best I could come up with so far.
static bool AlwaysKeepTemplateDirty = false;
// If true,the template output will be split into multiple files.
static bool SplitIntoMultipleFiles = true;
void RenderAdditionalCode() {
#>
static class T4MVCHelpers {
// You can change the ProcessVirtualPath method to modify the path that gets returned to the client.
// e.g. you can prepend a domain, or append a query string:
// return "http://localhost" + path + "?foo=bar";
private static string ProcessVirtualPathDefault(string virtualPath) {
// The path that comes in starts with ~/ and must first be made absolute
string path = VirtualPathUtility.ToAbsolute(virtualPath);
// Add your own modifications here before returning the path
return path;
}
// Calling ProcessVirtualPath through delegate to allow it to be replaced for unit testing
public static Func<string, string> ProcessVirtualPath = ProcessVirtualPathDefault;
// Logic to determine if the app is running in production or dev environment
public static bool IsProduction() {
return (HttpContext.Current != null && !HttpContext.Current.IsDebuggingEnabled);
}
}
<#+
}
#>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,5 @@
http://mvccontrib.codeplex.com/wikipage?title=T4MVC
Apache License

Просмотреть файл

@ -13,7 +13,7 @@
<RootNamespace>UsageDataAnalysisWebClient</RootNamespace>
<AssemblyName>UsageDataAnalysisWebClient</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<MvcBuildViews>true</MvcBuildViews>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>

Просмотреть файл

@ -12,7 +12,11 @@
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<!-- begin http://forums.asp.net/t/1546705.aspx -->
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<!-- end -->
</assemblies>
</compilation>