Where can I find the API specification for MvcTextTemplateHost?

一个人想着一个人 提交于 2019-11-30 13:56:17
public bool AddActionMethods { get; set; }
internal ProjectItem AreaFolder { get; set; }
public string AreaName { get; set; }
public List<string> AssemblyPath { get; set; }
public bool AutoEventWireup { get; set; }
public List<string> ContentPlaceHolderIDs { get; set; }
public Type ContextType { get; set; }
public string ControllerName { get; set; }
public string ControllerRootName { get; set; }
public string EntitySetName { get; set; }
public CompilerErrorCollection Errors { get; set; }
[Dynamic]
public object ExtendedProperties { [return: Dynamic] get; }
public Encoding FileEncoding { get; set; }
public string FileExtension { get; set; }
public Version FrameworkVersion { get; set; }
internal AppDomain GenerationAppDomain { get; set; }
public bool IsContentPage { get; set; }
public bool IsPartialView { get; set; }
public string MasterPageFile { get; set; }
IList<string> ITextTemplatingEngineHost.StandardAssemblyReferences { get; }
IList<string> ITextTemplatingEngineHost.StandardImports { get; }
public Type ModelType { get; set; }
public string Namespace { get; set; }
public string OutputFileExtension { get; set; }
public IPluralizer Pluralizer { get; set; }
public string PrimaryContentPlaceHolderID { get; set; }
public PrimaryKey[] PrimaryKeys { get; set; }
public bool ReferenceScriptLibraries { get; set; }
public Dictionary<string, RelatedModel> RelatedProperties { get; set; }
public string TemplateFile { get; set; }
public Type ViewDataType { get; set; }
public string ViewDataTypeName { get; set; }
public string ViewName { get; set; }
Jason Robertson
using Microsoft.VisualStudio.Web.Mvc.Scaffolding.BuiltIn;
using Microsoft.VisualStudio.Web.Mvc.UserInterface;

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TextTemplating.10.0.dll Microsoft.VisualStudio.TextTemplating.10.0.dll

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TextTemplating.10.0.dll Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE Microsoft.VisualStudio.Web.Mvc.4.0.dll

If you add theses as references to your ASP.NET MVC Web project and set it to the correct dll for your MVC version (last dll reference above) 2.0 3.01 0r 4.0 (still Beta)

You can copy the T4 code (not the tags) in and run it in a controller which will give intellisense and debugability you would need to set the right properties data and so on, on the MvcTextTemplateHost object on creation and populate it with meaningful data to see what it is doing (in theory this will work I hope)

As previously stated opening these in .NET Reflector will divulge some info. I have not looked into the code of MVCScaffolding the source is on codeplex its on my todo list). Question i have at the moment is what with and how are the RelatedProperties populated in the MvcTextTemplateHost when it runs in VS.NET 2010 T4.

Also can make use of Tangible T4 Editor for intellisense.

Reflector would be your best option. It allows you to decompile the DLL. You can download it directly at http://shop.reflector.net/download.

This is the closest thing to a spec we have but it is way out of date: http://blogs.msdn.com/b/webdevtools/archive/2009/01/29/t4-templates-a-quick-start-guide-for-asp-net-mvc-developers.aspx

You can use reflection or, you could take a look at the view templates, especially the identical helper methods at the bottom of each file, to see most of what is available in the MvcTextTemplateHost class.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!