Where to place the management session in a MVC pattern?
I've Application based on MVC architecture. - WEBproject - BLLproject - DALproject
In the web I use class "commands" attached to the pages "views" aspx.
I use a gridview connected to a ObjectDataSource (ods) with data stored in session.
the ods uses methods update, insert, delete to query a list of objects stored in session.
My problem is that I do no开发者_运维技巧t know where to put the methods used by the ods, I am tempted to put in my BLL layer.
It is not disorder to query session from the BLL layer?
hoping to have been fairly clear and understandable.
Thank you.
GridView with ObjectDataSource is not exactly what fits best in the ASP.NET MVC paradigm. In MVC the View should not be responsible for pulling data, it should only render the data that has been passed from the controller. This being said, IMHO Session management should be done by the Controller, either directly or indiretcly by delegating to some other class to which the controller would pass the Session dictionary. As an alternative of using GridView you might look at the MVCContrib Grid which is more adapted to ASP.NET MVC.
精彩评论