Building a forum application, Part 4
This is the fourth part in a series of posts where I build a forum application. The other posts can be found here:
- Building a forum application, Part 1
- Building a forum application, Part 2
- Building a forum application, Part 3
I decided to take Magnus advice and use the "data everywhere" approach to viewdata that Rob Conory use in his storefront application. This means that you will allways have everything available at all time in all pages. Rob does this by haveing methods at his base controller to set the data to the ViewDataDictionary. Then he have extension methods for his ViewDataDictionary to get the data in his views.
I decided to take a little bit different approach and still use my BaseViewModel (this name will probably change as soon as I come up with a more suitable one). I user methods at my base controller to set properties on my BaseViewModel, and all my pages will user the BaseViewModel as model. I decided to do it this way to avoid the "magic strings" you have to use when you use the ViewDataDictionary to save your data. I haven´t seen any dissadvantages so far, but If you see one, do please tell me.
Now I´m pretty happy with how the architecture of the application looks, and I will continue with programing the acctuall forum. I have created a AreaController with a "List" action that is responsible for listing all the areas in the forum. The action is only 2 lines and it uses only methods from my BaseService and BaseRepository which I´m pretty happy with.
Next time I will go into more real coding and create the listings for categories and items. I will allso need a nice design for the application, so If anyone feel that they are good designers and want to contribute feel free to contact me, as I´m no good designer.
You can download the source here or use a svn client to connect to: https://87.237.213.147:8443/svn/Mattias_Forum and download the source. You can log in with username: "User" and no password.