如何让 MvcScaffold 与外部模型一起工作?
Steve Sanderson 有一个很棒的博客,详细介绍了 MvcScaffolding。在这里查看它 http://blog.stevensanderson.com/2011/01 /13/mvcscaffolding-standard-usage/
他还有一个关于 http://channel9.msdn.com/Series/mvcConf/mvcConf-2-Steve-Sanderson-MvcScaffolding
在他的博客中,他提到...... ModelType:默认情况下,我们尝试从控制器名称推断这一点,但如果您希望控制器和模型具有完全不相关的名称,则可以使用此参数指定特定的模型类型。我们将找到在您的项目或其引用的另一个项目中定义的任何模型类,但不会在任何外部程序集中找到。
我们的 ViewModel 保存在同一解决方案中的单独项目中。但是,我们正在引用 DLL,因此 Get-ProjectType –ModelType ourVM –Project OurProject 找不到模型。
没问题,它是一个开源项目。我将记下代码并调整 Get-ProjectType。
我无法找到 Get-ProjectType 在 PowerShell 中的定义位置。 (已解决)
Steve Sanderson has a great blog that goes into the details of MvcScaffolding. See it here http://blog.stevensanderson.com/2011/01/13/mvcscaffolding-standard-usage/
He also has a great video on http://channel9.msdn.com/Series/mvcConf/mvcConf-2-Steve-Sanderson-MvcScaffolding
In his blog he mentions….
ModelType : By default we try to infer this from the controller name, but if you want your controllers and models to have totally unrelated names, you can specify a particular model type using this parameter. We’ll find any model class defined in your project or another project it references, but not in any external assembly.
Our ViewModels are kept in a separate project in the same solution. However we are Referencing the DLL so Get-ProjectType –ModelType ourVM –Project OurProject does not find the model.
No problem it is an open source project. I will down the code and tweek Get-ProjectType.
I am unable to find where Get-ProjectType is defined in PowerShell. (resolved)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们使用 MvcScaffold 创建自定义脚手架(请参阅 MvcConf 2 期间 steve sanderson 的视频)。然后我们的自定义脚手架调用我们的自定义 powershell 脚本来完成工作。
We used MvcScaffold to create custom Scaffolders ( see steve sanderson video during MvcConf 2). Then our custom scaffolder called our custom powershell scripts to do the work.