ASP.NET MVC 3 and NHibernate Scaffolding

青春壹個敷衍的年華 提交于 2019-12-21 02:26:14

问题


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.

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.

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

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


回答1:


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 :)




回答2:


I've seen a project, that tried to implement templates for NHibernate and MVC scaffolding, but according to this thread it seems to be closed.



来源:https://stackoverflow.com/questions/6995451/asp-net-mvc-3-and-nhibernate-scaffolding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!