How to use DTO between UI, BLL, DAL

I am trying to write a small application with very strict boundaries between BLL and DAL, and now I am wondering what is the best way to transfer data (domain transfer objects) between layers.

I have implemented some classes at the domain level (class library), which are accessed by both BLL and DAL. These classes basically just contain properties / data elements and currently reflect DAL data. Example:

class CustomerData
{
  // some data fields
}

Then I implemented some classes in BLL as:

class Customer : CustomerData
{
  // Some methods
}

In my DAL, I get client entries from the database through Linq-to-Sql. Then I map the linq object to the Domain object:

CustomerData.field = LinqObject.field
// Etc

My thinking is that I am now an instance of CustomerData from my DAL in the BLL on request (and that I have to pass the instance of Customer to my user interface).

BLL , , CustomerData, .

:

  • BLL Customer AGAIN ?
      c = ;  c.field = CustomerData.field;
  • CustomerData ?
  • ?
    {   CustomerData; }
  • ( ..) ?
  • ?
  • ?

!

+5
4

DTO , / DAL, BLL / .

VS, DTO - , .

, , , , DTO .

+8

, , , :)

, "" . . . , Data- - -. , -, ? , .

, -. , -, ( ), Dead Rabit. O/RM, EF 4.

, , DTO UI-. .

, Entity Framework 4 , .NET 4, ?

  • , , , .
  • ,
  • , , Entity Framework 4
  • (- "-)
  • .
+2

DTO, AutoMapper, ( DTO).

CustomerData customerData = Mapper.Map<LinqObject, CustomerData>(linqObjectInstance);

PresentationModel: http://martinfowler.com/eaaDev/PresentationModel.html

google MVVM (Model-View-ViewModel), .

+1

DTO. Customer CustomerData .

Customer CustomerData

EDIT: , CustomerData - DTO, Customer CustomerData, DTO, .

, BLL DAL.

DTO 1]

0

All Articles