Hi,
My current architecture is based around my entities being simple containers for data with little or no logic within them. Any business decisions are made by Service classes which take entities as arguments and then return data back. However, I'm finding that this approach is becoming a little unwieldy as our systems grow in size.
For example, we have an ASP.NET MVC web application which displays a list of products - some of these products may be available to order by the current user and some may not. In our controller class we fetch the products for display and then as each product is displayed on the page we have to call out to one of our service classes and determine whether this product is available to order for this customer.
<% For Each p In Model.Products %>
<%= Html.Encode(p.Title) %>
<% If AuthService.CanProductBeOrderedByUser(p, Model.CurrentUser) Then %>
<a href="#">Click here to order</a>
<% End If %>
<% Next %>
The problem is that this requires logic to be built into the page and also requires a call out to a service for each iteration. If I also need this information in more than one place it requires a lot of duplication.
Does anyone have comments on the above or any guidance as to how to improve this?
Thanks
James