如何为T4 Scaffolders添加命名空间?

时间:2016-01-25 15:14:07

标签: c# asp.net-mvc t4scaffolding

当我在我的软件包管理器控制台中运行Get-Scaffolder时,我得到以下输出:

Name                                Description                                                                                                                       Package                       
----                                -----------                                                                                                                       -------                       
MvcScaffolding.Action               Creates an action method, view model, and view                                                                                    MvcScaffolding.VS2015 1.0.12  
MvcScaffolding.ActionUnitTest       Creates a unit test stub for an action method                                                                                     MvcScaffolding.VS2015 1.0.12  
MvcScaffolding.ActionWithUnitTest   Creates an action method, view model, view, and unit test stub                                                                    MvcScaffolding.VS2015 1.0.12  
MvcScaffolding.AspxView             Adds an ASP.NET MVC view using the ASPX view engine                                                                               MvcScaffolding.VS2015 1.0.12  
MvcScaffolding.Controller           Adds an ASP.NET MVC controller with views and data access code                                                                    MvcScaffolding.VS2015 1.0.12  
MvcScaffolding.RazorView            Adds an ASP.NET MVC view using the Razor view engine                                                                              MvcScaffolding.VS2015 1.0.12  
MvcScaffolding.Views                Adds ASP.NET MVC views for Create/Read/Update/Delete/Index scenarios                                                              MvcScaffolding.VS2015 1.0.12  
T4Scaffolding.CustomScaffolder      Creates an entirely new scaffolder with a PS1 script and a T4 template                                                            T4Scaffolding.Core.VS2015 1...
T4Scaffolding.CustomTemplate        Allows you to modify the T4 template rendered by a scaffolder                                                                     T4Scaffolding.Core.VS2015 1...
T4Scaffolding.EFDbContext           Makes an EF DbContext able to persist models of a given type, creating the DbContext first if necessary                           T4Scaffolding.VS2015 1.0.8    
T4Scaffolding.EFRepository          Creates a repository                                                                                                              T4Scaffolding.VS2015 1.0.8    
BasicModel                          Starts with the existing Data Model and Scaffolds everything needed to get the Entity working                                                                   
Controller                          Adds a Controller and ApiController based on the templates                                                                                                
ControllerUnitTest                  Creates a default unit test for a controller. The controller must exist prior to running this scaffolder                                                        
EmptyModel                          Scaffold an empty Model                                                                                                                                         
Module                              Creates default module controller, service, model, view model and views                                                                                         
RegisterService                     Register the Service to the Service Interface in the MainContainer class                                                                                        
Service                             Adds a Service and Service Interface based on the templates     

最后几个脚手架,即:BasicModel,Controller等......都是我自己的定制脚手架。如何让它们显示为Custom.BasicModel,Custom.Controller等?

1 个答案:

答案 0 :(得分:0)

这实际上很简单!它不是典型意义上的命名空间的命名空间。它只是文件名。所以MvcScaffolding"命名空间中的脚手架"都有文件名,例如" MvcScaffolding.Views"。

将我的PS1文件的名称更改为" Project.COntroller"我能够添加一个"命名空间"我的脚手架。