0

当我在包管理器控制台中运行 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 等?

4

1 回答 1

0

这实际上很容易!它不是典型意义上的命名空间。这只是文件名。因此,MvcScaffolding“命名空间”中的脚手架都有文件名,例如“MvcScaffolding.Views”。

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

于 2016-01-25T15:37:12.220 回答