Best Practice, objects design ASP.NET MVC

Posted by DoomStone on Stack Overflow See other posts from Stack Overflow or by DoomStone
Published on 2010-05-10T22:37:52Z Indexed on 2010/05/10 22:44 UTC
Read the original article Hit count: 469

Hello Stackoverflow

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

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

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.

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about design-patterns