ASP.NET MVC 3和NHibernate脚手架 [英] ASP.NET MVC 3 and NHibernate Scaffolding

查看:114
本文介绍了ASP.NET MVC 3和NHibernate脚手架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现这篇文章[<一个href=\"http://blog.stevensanderson.com/2011/01/13/scaffold-your-aspnet-mvc-3-project-with-the-mvcscaffolding-package/\">http://blog.stevensanderson.com/2011/01/13/scaffold-your-aspnet-mvc-3-project-with-the-mvcscaffolding-package/],这也解释了如何使用MVC脚手架与EF一对许多关系,创建一个列表框具有枚举集合作为选择。

I found this article [http://blog.stevensanderson.com/2011/01/13/scaffold-your-aspnet-mvc-3-project-with-the-mvcscaffolding-package/], which explains how to use MVC Scaffolding with one-to-many relationships in EF to create a listbox with an enumerated collection as the choice.

我尝试使用这个与我的项目,但我遇到了一个问题 - 我不想使用EF(或包括对它的引用)。我使用这波苏斯然后使用一个仓库模式映射并坚持使用NHibernate。

I tried using this with my project, but I have run into a problem - I don't want to use EF (or include a reference to it). I am using POCOs which are then mapped using a repository pattern and persisted using NHibernate.

有没有一种方法来创建波苏斯同一脚手架列表框,而无需创建该项目创建了DataContext的。

Is there a way to create the same scaffolding listboxes for POCOs without having to create the DataContext which the article created.

编辑:我知道如何手动做到这一点,我要寻找的脚手架code为我做到这一点的方式。

I do know how to do this manually, I am looking for a way for the scaffold code to do this for me.

推荐答案

我认为的重写T4模板从同一系列应该告诉你所有你需要知道的切换到基于NHibernate的存储库模板。如果你最终实现你自己的,请地方张贴:)

I think the post on Overriding T4 Templates from the same series should tell you all you need to know to switch to a repository template based on NHibernate. If you end up implementing your own, please post them somewhere :)

这篇关于ASP.NET MVC 3和NHibernate脚手架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆