Some features:
Hard Coded Links
Solving the problem can solve the following approach. However, since it introduces hard-coded dependencies, the use of this is out of the question.
// in the master view model var detailViewModel = new DetailViewModel(new AccountService(), new TransactionService());
Resolution through IoC Framework
Another option would be for the parent view model to reference the IoC structure. This approach introduces the dependency of the main view model on the IoC framewok.
// in the master view model var detailViewModel = new DetailViewModel(resolver.GetNew<IAccountService>(), resolver.GetNew<IAccountService>());
Factory Func <> s
class MasterViewModel { public MasterViewModel(Func<Service.IAccountService> accountServiceFactory, Func<Service.ITransactionService> transactionServiceFactory) { this.accountServiceFactory = accountServiceFactory; this.transactionServiceFactory = transactionServiceFactory;
source share