What is the best way to actually implement service classes when following domain driven design?
For example say I want to have an AccountService
which can be used to transfer funds from one account to another? Which of the following, if any, would be the best way to implement this?
public class AccountService1
{
private IAccountRepository _accountRepo;
public AccountService1(IAccountRepository accountRepo)
{
_accountRepo = accountRepo;
}
public void TransferFunds(double ammount, int sourceAccountNumber, int targetAccountNumber)
{
//FUNDS TRANSFER CODE
}
}
public class AccountService2
{
public void TransferFunds(double ammount, Account sourceAccount, Account targetAccount)
{
//FUNDS TRANSFER CODE
}
}
public static class AccountService3
{
public static void TransferFunds(double amount, Account sourceAccount, Account targetAccount)
{
//FUNDS TRANSFER CODE
}
}
public static class AccountService4
{
public static void TransferFunds(double amount, int sourceAccountNumber, int targetAccountNumber, IAccountRepository repository)
{
//FUNDS TRANSFER CODE
}
}