samedi 2 janvier 2016

Components of DTO are Entities or DTOs as well?

I have question of terminology. Reffering to Fowler, DTO is "An object that carries data between processes in order to reduce the number of method calls." (http://ift.tt/1ng9nXP). As I understand, the only way to reduce method calls is to unite them. So DTO is composite object, containing some entities.

For example, we have two simple entities CoinInfo and ProductInfo:

public class CoinInfo
{
    public int CoinId { get; set; }
    public int Denomination { get; set; }
    public int Quantity { get; set; }
}


public class ProductInfo
{
    public int ProductId { get; set; }
    public ProductTypes ProductType { get; set; }
    public int Price { get; set; }
    public int Count { get; set; }
}

And we also have complex object SomeDto, uniting CoinInfo and ProductInfo.

public class SomeComplex
{
    public List<CoinInfo> UserWallet { get; set; }
    public List<ProductInfo> Products { get; set;}
}

So, ProductInfo and CoinInfo are "DTO"s also or just "entities"?

Aucun commentaire:

Enregistrer un commentaire