示例#1
0
        /// <summary>
        /// Create instance of MemberService
        /// </summary>
        /// <returns>Instance of MemberService</returns>
        public IMemberService Create()
        {
            //  Infrastructure;
            // :EF DbContext
            var context = new SiteMonitorDbDataContext();
            //  Infrastructure: RepositoryFactory
            IRepositoryFactory <SiteMonitorDbDataContext> repositoryFactory = new SiteMonitorRepositoryFactory(context);

            //  Unit of Work
            IMemberService memberService = new MemberService(context, repositoryFactory);

            return(memberService);
        }
        /// <summary>
        /// Create instance of SiteMonitorArchiveService
        /// </summary>
        /// <returns>Instance of SiteMonitorArchiveService</returns>
        public ISiteMonitorArchiveService Create()
        {
            //  Infrastructure;
            // :EF DbContext
            var context = new SiteMonitorDbDataContext();
            //  Infrastructure: RepositoryFactory
            IRepositoryFactory <SiteMonitorDbDataContext> repositoryFactory = new SiteMonitorRepositoryFactory(context);

            //  Unit of Work
            ISiteMonitorService siteMonitorService = new SiteMonitorService(context, repositoryFactory);

            //  Domain: Mappers
            IMapper <TestResult, ArchiveTestResult> testResultMapper = new MapTestResultToArchiveTestResult();
            IMapper <ScanResult, ArchiveScanResult> scanResultMapper = new MapScanResultToArchiveScanResult(testResultMapper);
            //  Domain: Archive service
            ISiteMonitorArchiveService siteMonitorArchiveService = new SiteMonitorArchiveService(siteMonitorService, scanResultMapper);

            return(siteMonitorArchiveService);
        }