creation of viewmodels
I am using the s#arp architecture, ASP.NET MVC 2.0 and NHibernate.
So far I have always created my view models on the fly (in real time after a web request) using, for example, automapper. Sometimes the creation of the view models might be too slow especially if I want to v开发者_如何学Pythoniew them in a data grid and use some filtering. I thought I could create my view models once (using dedicated persisted tables/classes) and update them after CUD operations. Does this make sense? Do other people do this? What’s the best practise here –how is it best triggered (e.g. I do not want to recreate all view models after each CUD operation).
Any feedback would be very much appreciated. Many thanks in advance.
Christian
Persisting view models into the database doesn't look right to me. Maybe you could investigate some other caching strategies instead? For instance this article on controller output caching.
精彩评论