public static void Start() { if (ServiceLocator.Start != null) { return; } ServiceLocator.Start = (IServiceLocator service) => { var profiler = new TestProfiler(); var host = new TestApplicationHost(profiler); var localizer = new TestLocalizer(); var dbContext = new SqlDbContext(profiler, host, localizer); var workflowEngine = new WorkflowEngine(host, dbContext); var renderer = new XamlRenderer(profiler); var scripter = new VueDataScripter(); service.RegisterService <IDbContext>(dbContext); service.RegisterService <IWorkflowEngine>(workflowEngine); service.RegisterService <IApplicationHost>(host); service.RegisterService <IProfiler>(profiler); service.RegisterService <IRenderer>(renderer); service.RegisterService <IDataScripter>(scripter); _currentService = service; }; ServiceLocator.GetCurrentLocator = () => { if (_currentService == null) { new ServiceLocator(); } return(_currentService); }; }
public static void Start() { if (ServiceLocator.Start != null) { return; } ServiceLocator.Start = (IServiceLocator service) => { var profiler = new NullProfiler(); var host = new TestApplicationHost(profiler) { HostingPath = Path.GetFullPath("../../../../Web/A2v10.Web.Site") }; var localizer = new NullLocalizer(); var dbContext = new SqlDbContext(profiler, host, localizer); var messaging = new NullMessaging(); var workflowEngine = new WorkflowEngine(host, dbContext, messaging); var renderer = new XamlRenderer(profiler, host); var scripter = new VueDataScripter(host, localizer); service.RegisterService <IDbContext>(dbContext); service.RegisterService <IWorkflowEngine>(workflowEngine); service.RegisterService <IApplicationHost>(host); service.RegisterService <IProfiler>(profiler); service.RegisterService <IRenderer>(renderer); service.RegisterService <ILocalizer>(localizer); service.RegisterService <IDataScripter>(scripter); service.RegisterService <IMessaging>(messaging); _currentService = service; }; ServiceLocator.GetCurrentLocator = () => { if (_currentService == null) { new ServiceLocator(); } return(_currentService); }; }