I am trying to re-evaluate our n-layer architecture and would like some suggestions based on your experience. Here is our typical .NET n-layer project (sometimes n-level).
Project.UI
Project.Services
Project.Business
Project.Model
Project.DataAccess
DataAccess usually consists of Entity Framework 4and classes Repository. I am trying to follow the concept Aggregate Rootto avoid storing the repository for the table, easier said than done in my experience. I usually have ~ 70% correspondence between repositories and tables.
Usually a model consists of my Entity Framework 4entities; I successfully use EF self-control objects.
Business is what I struggle with the most. Usually I have a class Managerfor everyone Repository. This class will contain methods such as .Add (), which will validate the business before being sent down to the .Add () repository.
Services, as a rule, I only implement this, if in fact I'm looking to create a solution based on a web service. At this level, request / response marshaling between DTOs and entities will be set. And most importantly provide a more coarse grainedinterface. For example, TradeService.SubmitTrade (), which is really facadefor a business transaction, which may include AccountManager.ValidateCash (), OrderManager.SubmitOrder (), etc.
- , , . , - , ( "-" ). , , -, , " () - , -. , TradingService.submitTrade() -, , ..
, - , , -, . , - -? , , PhoneManager EmailManager ( , ) , ContactsManager ( , Contact). , ContactManager.GetPhones() ContactManager.GetEmail() ..
, -, , , , , -, .. ORM ..