public static void Bootstrap(ServiceContainer container) { RegisterRepositories(container); RegisterQueryServices(container); RegisterBusinessLogics(container); RegisterServices(container); RegisterServiceFacades(container); RegisterMappers(); IServiceLocator serviceLocator = new LightInjectServiceLocator(container); ServiceLocator.SetLocatorProvider(() => serviceLocator); }
private static IMediator BuildMediator() { var serviceContainer = new ServiceContainer(); serviceContainer.Register <IMediator, Mediator>(); serviceContainer.RegisterAssembly(typeof(Ping).Assembly, (serviceType, implementingType) => !serviceType.IsClass); serviceContainer.RegisterAssembly(typeof(IMediator).Assembly, (serviceType, implementingType) => !serviceType.IsClass); serviceContainer.RegisterInstance(Console.Out); var serviceLocator = new LightInjectServiceLocator(serviceContainer); serviceContainer.RegisterInstance(new ServiceLocatorProvider(() => serviceLocator)); return(serviceContainer.GetInstance <IMediator>()); }
static void Main() { ServiceContainer serviceContainer = new ServiceContainer(); IServiceLocator serviceLocator = new LightInjectServiceLocator(serviceContainer); ServiceLocator.SetLocatorProvider(() => serviceLocator); ServiceConfig.Register(serviceContainer); #if DEBUG var service = new JobService(); service.OnDebug(); System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite); #else ServiceBase.Run(new JobService()); #endif }