コード例 #1
0
        public void SetUp()
        {
            Kernel.Bind <IEngine>().To <Engine>().InSingletonScope();

            // Run installation tasks
            Kernel.Bind(x =>
                        x.FromAssemblyContaining <StateService>()
                        .SelectAllClasses()
                        .BindAllInterfaces()
                        .Configure(f => f.InTransientScope()));

            // Bind Database Repository
            Kernel.Rebind(typeof(IRepository <>)).To(typeof(EfRepository <>));

            Kernel.Bind <IDbContext>().To <DataContext>().InSingletonScope()
            .WithConstructorArgument("nameOrConnectionString", ConnectionStringManager.ConnectionString);

            Kernel.Bind <IIncluder>().To <DbIncluder>().InTransientScope();

            Kernel.Rebind <ICacheManager>().To <MemoryCacheManager>().InThreadScope();

            Kernel.Rebind <ILogService>().To <LogService>().InThreadScope();

            _jobGroupService = Kernel.Get <IJobGroupService>();

            _chassisService        = Kernel.Get <IChassisService>();
            _containerOwnerService = Kernel.Get <IContainerOwnerService>();
            _containerService      = Kernel.Get <IContainerService>();
            _stopActionService     = Kernel.Get <IStopActionService>();

            _subscriberService = Kernel.Get <ISubscriberService>();

            _driverService           = Kernel.Get <IDriverService>();
            _vehicleService          = Kernel.Get <IVehicleService>();
            _userService             = Kernel.Get <IUserService>();
            _stateService            = Kernel.Get <IStateService>();
            _locationService         = Kernel.Get <ILocationService>();
            _locationDistanceService = Kernel.Get <ILocationDistanceService>();

            Kernel.Rebind <IDomainModelMapper>().To <DomainModelAutoMapper>().InThreadScope();
            _mappingService = Kernel.Get <IDomainModelMapper>();

            _jobService           = Kernel.Get <IJobService>();
            _routeStopService     = Kernel.Get <IRouteStopService>();
            _locationGroupService = Kernel.Get <ILocationGroupService>();
            _weatherCityService   = Kernel.Get <IWeatherCityService>();

            AutoMapperInitializer.Initialize();
        }
コード例 #2
0
 public MapperService(IRouteSanitizer routeSanitizer, IRouteStopService routeStopDataService,
                      ILocationService locationService, IJobService jobService, IPlanService planService,
                      IDriverService driverService, IDateTimeHelper dateTimeHelper, IStopActionService stopActionService,
                      IRouteStopDelayService routeStopDelayService,
                      IOptimizationDateTimeHelper optDateTimeHelper)
 {
     _routeSanitizer        = routeSanitizer;
     _routeStopDataService  = routeStopDataService;
     _locationService       = locationService;
     _jobService            = jobService;
     _planService           = planService;
     _driverService         = driverService;
     _dateTimeHelper        = dateTimeHelper;
     _stopActionService     = stopActionService;
     _routeStopDelayService = routeStopDelayService;
     _optDateTimeHelper     = optDateTimeHelper;
 }