问题
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