On a WPF project I'm developing with Catel framework, I'm using IoC pattern to inject services and repositories. I wish to use NDpend to find if all the injected interfaces have the following check applied. Please consider the following constructor
public ManageInstrumentsViewModel(IMarkToMarketRepository repository, IViewModelFactory viewModelFactory,
IPortfoliosService portfoliosService, IPkInstrumentsService pkInstrumentsService)
{
this.repository = repository;
this.viewModelFactory = viewModelFactory;
this.portfoliosService = portfoliosService;
this.pkInstrumentsService = pkInstrumentsService;
Model = new FilterDateRangePortfolioModel {NeedPortfolio = false};
PortfolioModel = new PortfolioModel();
LoadMtmInstrumentsCommand = new TaskCommand(OnLoadMtmInstrumentsCommandExecute, (() => CanLoadMtmCurrenciesCommandExecute));
ModifyValueCommand = new TaskCommand<MtmInstrument>(OnModifyValueCommandExecute, mtmCurrencyResult => IsFunctionReadWrite);
}
This hasn't got the check I need to verify with NDepend.
The corrected one should be
public ManageInstrumentsViewModel(IMarkToMarketRepository repository, IViewModelFactory viewModelFactory,
IPortfoliosService portfoliosService, IPkInstrumentsService pkInstrumentsService)
{
Argument.IsNotNull(()=>repository);
Argument.IsNotNull(()=> viewModelFactory);
Argument.IsNotNull(()=> portfoliosService);
Argument.IsNotNull(()=> pkInstrumentsService);
this.repository = repository;
this.viewModelFactory = viewModelFactory;
this.portfoliosService = portfoliosService;
this.pkInstrumentsService = pkInstrumentsService;
Model = new FilterDateRangePortfolioModel {NeedPortfolio = false};
PortfolioModel = new PortfolioModel();
LoadMtmInstrumentsCommand = new TaskCommand(OnLoadMtmInstrumentsCommandExecute, (() => CanLoadMtmCurrenciesCommandExecute));
ModifyValueCommand = new TaskCommand<MtmInstrument>(OnModifyValueCommandExecute, mtmCurrencyResult => IsFunctionReadWrite);
}
The Argument.IsNotNull can be found here