vendredi 1 mai 2015

How to use DTO classes

Good time!

I develop the Ideal project. I have some application design issues. It's difficult to me to understand how use DTO, DAL, BAL. For example I have 3 Business Entities: Order, Customer, Product (in SQL for about 10 tables).

Questions:

  1. What should I do with a lot of classes. There is a class generated by the ORM (EF) e.g DBOrder. There is a class (almost a copy) OrderDTO. Which contains only fields from DBOrder (perhaps even related fields but also DTO). There is a business class OrderModel (which pass from DAL to BAL).
  2. If I want to work with some fields of full object (Product), should I create new DTO class (e. g. I need only Id and Name)?
  3. The same question for Business Logic Object.

I see 3 classes for 1 object (ORM, DTO, BLO). Is it ok?

Please, tell me truth.

Aucun commentaire:

Enregistrer un commentaire