asp.net-mvc – 带有实体框架的MVC控制器的T4模板 – 主机的成员
发布时间:2020-12-16 06:37:53 所属栏目:asp.Net 来源:网络整理
导读:有没有人完全引用我可以在MVC 3附带的T4模板ControllerWithContext.tt中使用的Host对象的成员? 我已经尝试了我能想到的每一个谷歌搜索,但唯一相关的结果是这个页面: http://blogs.msdn.com/b/webdevtools/archive/2009/01/29/t4-templates-a-quick-start-g
有没有人完全引用我可以在MVC 3附带的T4模板ControllerWithContext.tt中使用的Host对象的成员?
我已经尝试了我能想到的每一个谷歌搜索,但唯一相关的结果是这个页面: 但它只显示4个属性(ItemName,NameSpace,ExtraActionMethods,ControllerRootName)而不是完整列表.在模板中有像RelatedProperties,EntitySetName,ModelType和ContextType之类的东西. 我正在尝试查找完整的属性列表,其类型和说明.任何帮助将不胜感激. 解决方法
当您在Visual Studio 2010中使用“添加视图”或“添加控制器”对话框时,我已将非官方的
ASP.NET MVC 3 properties available to T4 templates列表放在一起.它不包括在NuGet包管理器控制台中使用MvcScaffolding时可用的属性.使用T4模板确定属性信息以反映MvcTextTemplateHost上的公共属性.
添加控制器: +--------------------+---------------+----------------------------------------------------------------------------------------+ | Property Name | Type | Description | +--------------------+---------------+----------------------------------------------------------------------------------------+ | AddActionMethods | Boolean | Adds action methods to the generated controller class. | | AreaName | System.String | The name of the Area that the controller is created for. | | ContextType | System.Type | The type of the data context. | | ControllerName | String | The name of the controller class that will be generated. | | ControllerRootName | String | The name of the controller class excluding the Controller part at the end of the name. | | EntitySetName | String | Name of the property on the data context class containing the set of entities. | | ModelType | System.Type | The type of the model class specified in the Add Controller dialog. | | Namespace | String | Namespace that will be used for the generated controller class. | | PrimaryKeys | PrimaryKey[] | Primary keys for the model. See table at end for PrimaryKey properties. | | RelatedProperties | Dictionary | Related properties on the model. See table at end for RelatedModel properties. | +--------------------+---------------+----------------------------------------------------------------------------------------+ 添加视图: +-----------------------------+---------------+------------------------------------------------------------------------------------------+ | Property Name | Type | Description | +-----------------------------+---------------+------------------------------------------------------------------------------------------+ | AreaName | System.String | The name of the Area that the view is being created for. | | ContentPlaceHolderIDs | List<string> | List of content place holder IDs in the master page. | | IsContentPage | Boolean | True if the generated view will be created with a master page or a Razor layout page. | | IsPartialView | Boolean | True if the generated view is a partial view (e.g. an ASP.NET user control). | | MasterPageFile | String | Master page file or Razor layout to be used with view (e.g. ~/Views/Shared/Site.Master). | | Namespace | String | Namespace that will be used for the generated view. | | PrimaryContentPlaceHolderID | String | Primary content place holder ID to be used when creating a view using a master page. | | ReferenceScriptLibraries | Boolean | True if checked in the Add View dialog. | | ViewDataType | System.Type | The view model's type. | | ViewDataTypeName | String | Fully qualified name for the view model's type. | | ViewName | String | Name of the view. | +-----------------------------+---------------+------------------------------------------------------------------------------------------+ 共同属性: +---------------------+-------------------------+-----------------------------------------------------------------------------------------------+ | Property Name | Type | Description | +---------------------+-------------------------+-----------------------------------------------------------------------------------------------+ | AssemblyPath | List<string> | List of assemblies referenced by the project and the project's output assembly. Internal use. | | Errors | CompilerErrorCollection | Used to stored errors that occur whilst processing the T4 template. Internal use. | | FileEncoding | System.Text.Encoding | The encoding of the file that will be generated. | | FileExtension | String | Not set. | | FrameworkVersion | System.Version | The .NET framework version. | | OutputFileExtension | System.String | The extension of the file that will be generated. | | TemplateFile | System.String | The full path to the T4 template file being used. | +---------------------+-------------------------+-----------------------------------------------------------------------------------------------+ (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 验证消息中的换行符
- asp.net-mvc – 使旧会话Cookie无效 – ASP.Net标识
- 调试时无法更改ASP.NET代码隐藏
- asp.net – 绝对定位是最佳实践还是我应该避免它?
- asp.net-mvc – 让System.Web.Optimization在类库中的剃刀视
- asp.net – 如何在Visual Studio 2008中安装(获取)LINQ?
- asp.net-mvc – 如何从ValidationAttribute中获取模型元数据
- 具有前缀的控件的Asp.Net MVC2 Clientside验证问题
- asp.net – UpdatePanel和ClientIDMode =“静态”的可能解决
- ASP.NET和C#重定向
推荐文章
站长推荐
- asp.net-mvc-3 – 如何在MVC3中格式化小数超过2位
- asp.net-mvc – asp.net mvc区域的默认页面
- asp.net-mvc – 在ASP.NET MVC 5应用程序中启用S
- asp.net-mvc-3 – MVC将方法添加到jquery.valida
- identity – 更改MVC 5中的用户名
- asp.net – Textbox错误的价值
- asp.net-core-mvc – 创建多个dbcontexts的MVC 6
- asp.net – 敏捷,Scrum和CMMI TFS流程模板有什么
- asp.net-mvc-3 – 如何为MVC3生成服务和存储库层
- 全局错误登录ASP.Net MVC 6
热点阅读