internal ApproachService( Func <ISessionFactory, IApproachRepository> approachRepositoryFactory, Func <ISessionFactory, IEsaRepository> esaRepositoryFactory, ISessionFactoryProvider sessionFactoryProvider, IDeviationObserver deviationObserver, IDeviationFactory deviationFactory, IEsaDtoBuilder builder, IEsaFactory factory) { if (approachRepositoryFactory == null) { throw new ArgumentNullException("approachRepositoryFactory"); } if (esaRepositoryFactory == null) { throw new ArgumentNullException("esaRepositoryFactory"); } if (sessionFactoryProvider == null) { throw new ArgumentNullException("sessionFactoryProvider"); } if (deviationObserver == null) { throw new ArgumentNullException("deviationObserver"); } if (deviationFactory == null) { throw new ArgumentNullException("deviationFactory"); } if (builder == null) { throw new ArgumentNullException("builder"); } if (factory == null) { throw new ArgumentNullException("factory"); } ISessionFactory sessionFactory = sessionFactoryProvider.ForWorkspace(); this.approachRepository = approachRepositoryFactory.Invoke(sessionFactory); this.esaRepository = esaRepositoryFactory.Invoke(sessionFactory); this.deviationFactory = deviationFactory; this.deviationObserver = deviationObserver; this.builder = builder; this.factory = factory; }
// Requires the double delegate method to process a domain service (per Vaughn Vernon). public void Evaluate( IDeviationObserver deviationObserver, IDeviationFactory deviationFactory) { if (this.Criteria.Value == CriteriaType.NATO) { bool result = this.Esa == null; if (result) { Deviation deviation = deviationFactory.CreateDeviation( DeviationMessageConstants.APPR_ESA_REQUIRED_FOR_NATO, DeviationMessageConstants.APPR_ESA_REQUIRED_FOR_NATO_SEVERITY); deviationObserver.PublishDeviation(DeviationMessageConstants.APPR_ESA_REQUIRED_KEY, deviation); } } }
public DeviationService( IApproachService approachService, IDeviationObserver deviationObserver, IDeviationFactory deviationFactory) { if (approachService == null) { throw new ArgumentNullException("approachService"); } if (deviationObserver == null) { throw new ArgumentNullException("deviationObserver"); } if (deviationFactory == null) { throw new ArgumentNullException("deviationFactory"); } this.approachService = approachService; this.deviationObserver = deviationObserver; this.deviationFactory = deviationFactory; }