GetAllProjects - List/Detail?

Aug 9, 2008 at 3:54 PM
Hi Tim,

In the SmartCA.Model.Projects.ProjectService you have a service called GetAllProjects which returns a list of projects that are fully hydrated. You use this on the drop down list (SelectProjectViewModel) to select a project to work on. Is there any way to provide the information for the list without retrieving all the attributes like the market segment, contract, employee and company? All you are using is the name and number for the drop down list. How do you handle this in other projects where you may have thousands of projects with lots more associations with other classes? Could you create a lite version of the Project entity somthing like ProjectSummary which only contained the local attributes for the Project like name, number etc?

The reason I am asking is that I am building a sample e-commerce site based on the SmartCA Project and I need to display lists of products but I don't want to fully hyrdrate them as this is quite costly with lost of database calls, plus I won't need any of the information like user reviews, similar products etc when I am just showing the top 20 products in a category. My Idea was to create a value object called ProductSummary and an entity called Product - this way it would be clear to any other developers what each class did. I justified having this ProductSummary value object in my domain model because when talking to the business domain expert would have said that the shop needs to display a summary of a product for lisitng/search results and a detailed view of a product when a customer wanted to a see all the information of a product. Then he may have gone on to say that when a product needs to be added to the catalogue he wouldn't be adding a product summary but he would add a product with all its details, and only a product detail would be edited. - Hope that all makes sense!

I was wondering how you handle situations like this and if my reasoning above makes sense?

Aug 12, 2008 at 8:37 AM

That is definitely one way to do could also implement lazy-loading on any properties that require the loading of other more expensive objects, and/or some type of caching strategy as well.