MVC 脚手架:是否有 Windows PowerShell 命令可以在解决方案中切换项目?
我正在编写一个脚手架来在 ASP.Net MVC 3 项目中自动创建类。但是,我的解决方案包含四个项目(MyProject.Domain、MyProject.Data、MyProject.Services 和 MyProject.Web),并且在脚手架中的某个时刻,我需要以编程方式切换项目。有办法做到这一点吗?我想,这与询问是否有 Windows PowerShell 命令来修改默认项目是一样的。
如果这有助于理解,这就是我想做的。我想从 MyProject.Web 启动脚手架来创建控制器和视图,并且我希望脚手架也能够为我指定的模型创建存储库和服务。但是,存储库类和服务类应该位于不同的项目中(MyProject.Data 和 MyProject.Services)。
更新:
提出问题的另一种方式是:如果我在 MyProject.Web 中调用一个脚手架,这个脚手架可以调用 MyProject.Data 中的另一个脚手架吗? MyProject.Web 和 MyProject.Data 是同一解决方案中的两个项目。
I am writing a scaffolder to create classes automatically in an ASP.Net MVC 3 project. However, my solution contains four projects (MyProject.Domain, MyProject.Data, MyProject.Services and MyProject.Web), and at some point in the scaffolder, I would need to switch project programatically. Is there a way to do that? This is, I guess, the same thing as asking whether there is a Windows PowerShell command to witch default project.
In case this helps to understand, here is what I want to do. I want to launch the scaffolder from MyProject.Web to create a Controller and Views, and I would like the scaffolder to also have the ability to create the repository and the service for the model I specify. However, the repository class and the service class should go in different projects (MyProject.Data and MyProject.Services).
UPDATE:
Another way of asking the question is: If I call a scaffolder in MyProject.Web, can this scaffolder call another scaffolder in MyProject.Data for example? MyProject.Web and MyProject.Data being two projects in the same solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚发现 Scaffold 命令有一个 -P 选项来指定项目,所以这可以解决我的问题。从 MyProject.Web 调用的脚手架可以调用 Scaffold Repository -P "MyProject.Data" SomeModel
I just found out that the Scaffold command has a -P option to specify the project, so this would solve my problem. A scaffolder called from MyProject.Web, could call Scaffold Repository -P "MyProject.Data" SomeModel