Some questions

Jul 14, 2009 at 8:41 AM

It is a good sample and I have learnt a great deal as a newbie. I do have the following questions

1. Isn't it the OO practice to encapsulate methods inside Entities? e.g. expense.Create() instead of CreateExpense(Expense expense). This will create a very clumsy Business Component layer for large applications.

2. Why abandon WPF? Is WPF not good for Layered Architecture?

3. To use WPF binding or to have some really complex UI, it is a better choice to use Data Transfer Objects (DTOs) instead of referencing Business Entities directly from UI?


Michael Leung

Jul 17, 2009 at 10:20 AM
Edited Jul 17, 2009 at 10:20 AM

Hi Michael,

I'm glad to know that the sample was useful to you.

Here are the answers to your questions:

1. You are right that OO practice encourages having data and behavior inside classes. However, in the case of our application, the Business Entities are used as data containers to carry data across the layers (and also possibly to other systems). When your objects are serialized across boundaries (especially to other platforms), your methods won't survive the serialization. Having a business component to manage the behavior helps centralize the processing logic in one place and keeps the references to the data access components isolated to the application tier. Take note that one business component manages multiple entities and the business components expose via service interfaces can service any systems of any platform with the same business logic.

2. WPF was not abandoned. It is just not included in the sample because I have not learn it well enough. WPF like any other client technologies, can integrate directly into the Layered Architecture at the Presentation layer.

3. If you keep your business entities light and don't include any methods in there, your business entities are the DTOs. You do not need an additional mapper or translator to convert BEs to DTOs.

Hope this helps.

Best Regards,

Aug 3, 2009 at 11:59 AM

Just a follow-up question in #3. I notice that the EF is placed under the business entities, What is the reason why you did not place it in DA? 

Sep 10, 2009 at 12:32 PM


The reason is because the current EF tool can't generate the code separately to different code files. Hence, the context is embedded into the Entities project.

Best Regards,