According to "Domain Driven Design",domain service encapsulates business logic that doesn't naturally fit within a domain object.The definition of domain service is clear,but how can i distinguish whether a business action belong to a domain object or domain service.For example i have a Account class,and a business action call transfer,both domain service and domain object can finish the transfer task.which one should i choose?
public class Account
{
public void Transfer(Account bar)
{
//do something
}
}
public class AccountService
{
public void Transfer(Account foo,Account bar)
{
//do something
}
}
Aucun commentaire:
Enregistrer un commentaire