/// <summary> /// TODO: Add summary here. /// </summary> /// <param name="context"></param> public void StartService(ApplicationServiceContext context) { if (!this.HasStarted) { this.HasStarted = true; } }
/// <summary> /// Called by an application in order to initialize the application extension service. /// </summary> /// <param name="context">Provides information about the application state. </param> public void StartService(ApplicationServiceContext context) { var logLevel = LogSeverityLevel; if (context.ApplicationInitParams.ContainsKey(Constants.INIT_PARAM_LOGLEVEL)) { logLevel = (LogSeverity) Enum.Parse(typeof(LogSeverity), context.ApplicationInitParams[Constants.INIT_PARAM_LOGLEVEL], true); } _mainCatalog = new AggregateCatalog(new DeploymentCatalog()); // empty one adds current deployment (xap) _container = new CompositionContainer(_mainCatalog); CompositionHost.Initialize(_container); CompositionInitializer.SatisfyImports(this); if (Logger == null) { ILogger defaultLogger = new DefaultLogger(logLevel); _container.ComposeExportedValue(defaultLogger); } else { Logger.SetSeverity(logLevel); } DeploymentService.Catalog = _mainCatalog; DeploymentService.Container = _container; _mefDebugger = new MefDebugger(_container, Logger); }
/// <summary> /// Called by an application in order to initialize the application extension service. /// </summary> /// <param name="context">Provides information about the application state.</param> public virtual void StartService(ApplicationServiceContext context) { _current = (TService)this; // added to allow for xaml binding. Application.Current.Resources.Add(ServiceName, this); Logger <TService> .Info("Service '{0}' Started.", ServiceName); }
/// <summary> /// Called by an application in order to initialize the application extension service. /// </summary> /// <param name="context">Provides information about the application state. </param> public void StartService(ApplicationServiceContext context) { if (DesignerProperties.IsInDesignTool) { return; } Current = this; }
/// <summary> /// 启动本地数据库服务 /// </summary> /// <param name="context">应用程序池</param> public void StartService(ApplicationServiceContext context) { if (DesignerProperties.IsInDesignTool) { return; } sengine = new SterlingEngine(); Current = this; }
public void StartService(ApplicationServiceContext context) { CompositionHost.Initialize( new AssemblyCatalog( Application.Current.GetType().Assembly), new AssemblyCatalog(typeof(AnalyticsEvent).Assembly), new AssemblyCatalog(typeof(TrackAction).Assembly)); _innerService.StartService(context); }
public void Can_throw_on_non_valid_payload() { // Arrange. var kernel = new StandardKernel(); kernel.Bind <PayloadValidator>().ToSelf().InSingletonScope(); kernel.Bind <IValidator <TestApplicationService.TestPayload> >().To <TestApplicationService.TestPayloadValidator>().InSingletonScope(); kernel.Bind <PayloadValidationFilter <ApplicationServiceContext, PipelineContext> >().ToSelf().InSingletonScope(); var filter = kernel.Get <PayloadValidationFilter <ApplicationServiceContext, PipelineContext> >(); var service = new TestApplicationService(); var context = new ApplicationServiceContext(new TestApplicationService.TestPayload()); // Act & Assert. Assert.Throws <PayloadValidationException>(() => filter.Process(context, new PipelineContext(service))); }
public void Can_invoke_service_without_filters() { // Assert. var kernel = new StandardKernel(); kernel.BindApplicationServicePipeline(); var payload = new EchoPayloadValueService.Payload { Value = 1 }; var context = new ApplicationServiceContext(payload); // Act. var result = kernel.Get <ApplicationServiceInvoker>().Invoke <EchoPayloadValueService, EchoPayloadResult>(context); // Assert. result.Value.ShouldBe(1); }
public static OrderModule Initialize(IReliableStateManager stateManager, Func <ITransaction, IEventStore> store, Func <ITransaction, IEvent[], Task> outbox, Func <IEvent[], Task> eventLogger) { var commandDispatcher = new Dispatcher <ICommand, Task>(); var policies = new EventProcessor(); var projections = new EventProcessor(); var queryDispatcher = new QueryDispatcher(); var queueSerializer = Serialization.Json(); var publisher = new EventPublisher(outbox, eventLogger, (tx, evts) => projections.PublishAsync(evts)); var context = new ApplicationServiceContext(stateManager, store, publisher); commandDispatcher .WithContext(context) .Register <CreateOrderCommand>(CreateOrderApplicationService.ExecuteAsync); policies.RegisterReceptor <CartCheckedoutEvent>(commandDispatcher, FooPolicy.When); return(new OrderModule(commandDispatcher, policies.Merge(projections.PublishAsync), queryDispatcher)); }
/// <summary> /// Raises the <see cref="E:System.Windows.Application.Startup"/> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param> protected override void OnStartup(StartupEventArgs e) { var applicationServiceContext = new ApplicationServiceContext(); foreach (IApplicationService service in ApplicationLifetimeObjects) { service.StartService(applicationServiceContext); var aware = service as IApplicationLifetimeAware; if (aware != null) aware.Starting(); } base.OnStartup(e); ApplicationLifetimeObjects .OfType<IApplicationLifetimeAware>() .ForEach(a => a.Started()); }
/// <summary> /// Called by an application in order to initialize the application extension service. /// </summary> /// <param name="context">Provides information about the application state. </param> public void StartService(ApplicationServiceContext context) { if (!context.ApplicationInitParams.ContainsKey("feedUri")) { throw new Exception("Must be configured with the feed."); } var mode = context.ApplicationInitParams.ContainsKey("mode") ? context.ApplicationInitParams["mode"] : "Mock"; if (string.IsNullOrEmpty(mode)) { mode = "Mock"; } Mode = mode; FeedUri = new Uri(context.ApplicationInitParams["feedUri"], UriKind.Absolute); }
public static CartModule Initialize( IReliableStateManager stateManager, Func <ITransaction, IEventStore> store, Func <ITransaction, IEvent[], Task> outbox, Func <IEvent[], Task> eventLogger) { var commandDispatcher = new Dispatcher <ICommand, Task>(); var policies = new EventProcessor(); var projections = new EventProcessor(); var queryDispatcher = new QueryDispatcher(); var publisher = new EventPublisher(outbox, eventLogger, (tx, evts) => projections.PublishAsync(evts)); var context = new ApplicationServiceContext(stateManager, store, publisher); commandDispatcher .WithContext(context) .Register <AddItemCommand>(AddItemApplicationService.ExecuteAsync) .Register <CheckoutCommand>(CheckoutApplicationService.ExecuteAsync); return(new CartModule(commandDispatcher, policies.Merge(projections.PublishAsync), queryDispatcher)); }
public void StartService(ApplicationServiceContext context) { Current = this; }
public static Task ExecuteAsync(ApplicationServiceContext context, CreateOrderCommand command) => context.ExecuteAsync <OrderState>(command, state => new[] { new OrderCreatedEvent(Guid.Parse(command.AggregateId.ToString())) });
void IApplicationService.StartService(ApplicationServiceContext context) { }
void IApplicationService.StartService(ApplicationServiceContext context) { _dispatcherTimer.Start(); }
public static Task ExecuteAsync(ApplicationServiceContext context, CheckoutCommand command) => context.ExecuteAsync <CartState>(command, state => new[] { new CartCheckedoutEvent(Guid.Parse(command.AggregateId.Id)) });
public void StartService(ApplicationServiceContext context) { CompositionHost.Initialize( new AssemblyCatalog(Application.Current.GetType().Assembly), new AssemblyCatalog(typeof(AnalyticsEvent).Assembly), new AssemblyCatalog(typeof(TrackAction).Assembly), new AssemblyCatalog(typeof(GoogleAnalytics).Assembly)); _innerService.StartService(context); }
public void StartService(ApplicationServiceContext context) { _frameworkDispatcherTimer.Start(); }
void IApplicationService.StartService(ApplicationServiceContext context) { timer.Start(); }
public void StartService(ApplicationServiceContext context = null) { this._timer.Start(); }
public void StartService(ApplicationServiceContext context) { _timer.Start(); }
void IApplicationService.StartService(ApplicationServiceContext context) { this.frameworkDispatcherTimer.Start(); }
/// <summary> /// Called by an application in order to initialize the application extension service. /// </summary> /// <param name="context">Provides information about the application state.</param> public void StartService(ApplicationServiceContext context) { }
void IApplicationService.StartService(ApplicationServiceContext context) { LoadConfigSettings(); }
public static Task ExecuteAsync(ApplicationServiceContext context, AddItemCommand command) => context.ExecuteAsync <CartState>(command, state => new[] { new ItemAddedEvent(command.AggregateId) });