Best Practice, objects design ASP.NET MVC
I have a code design question that have been torbeling me for a while, you see I’m doing a refactoring of my website Cosplay Denmark, a site where cospalyers can upload images of them self in their costumes. The original site was done in php, Zend MVC, but my refactoring is being done in ASP.NET MVC 2.
If you take the site http://www.cosplaydanmark.dk/Costumes/ (You can switch to English in the left column (Sprog))
Here you see a list of all the anime’s we have on the site with images, we show the name, how many different characters and how many images there are under this anime.
http://www.cosplaydanmark.dk/Costumes/Bleach
If you click on an anime will you get a list of characters within the given anime which we have images in, here do we show the character name, how many galleries and how many images.
http://www.cosplaydanmark.dk/Costumes/Bleach/Ichigo_Kurosaki/
If you click on the character name, will you get a list of the 开发者_开发问答galleries under the given character in the given anime. Here we have some information about the gallery, such as image count.
http://www.cosplaydanmark.dk/Costumes/Bleach/Ichigo_Kurosaki/Admi/
Should you click the gallery do you get a list of the images in the gallery.
My database look like this at the moment.
Database Design http://sogaard.us/uploades/dbdesign.jpg
As you can might imagine there are a lot of different query’s to create the site, on the first site I need to do a select on the on the “animes” table and for each result, I need to do a count select on characters and galleries.
My plan to create this will be one of the following
Objects plan http://sogaard.us/uploades/objectsetup.jpg
Where the IList, would be a lazy load list.
But I can’t decide what would be the best solution for this would be, also if there is a better way of doing this. My priority is to have good performance with a minimum lose of features and code upkeep.
I’m using a service pattern with a linq to sql repository.
My design is not absolute, I’m willing to change it if it could increase performance :D
I hope that I have describe my question good enough for you to understand what I mean, but ask away if there are anything I have missed.
I personally like to be able to tie the and back to the
So that each and have an animeId property that is a foreign key back to
So that I can do a simple query getAllImagesByAnimeId
精彩评论