示例#1
0
        public void Activate()
        {
            IApplicationBuilder appBuilder = new ApplicationBuilder(_serviceProvider);

            appBuilder.Properties["host.AppName"] = _shellSettings.Name;

            var orderedMiddlewares = _middlewareProviders
                                     .SelectMany(p => p.GetMiddlewares())
                                     .OrderBy(obj => obj.Priority);

            foreach (var middleware in orderedMiddlewares)
            {
                middleware.Configure(appBuilder);
            }

            appBuilder.UseOrchard();

            var pipeline = appBuilder.Build();

            var allRoutes = new List <RouteDescriptor>();

            allRoutes.AddRange(_routeProviders.SelectMany(provider => provider.GetRoutes()));

            _routePublisher.Publish(allRoutes, pipeline);

            _eventNotifier.Notify <IOrchardShellEvents>(x => x.Activated());
        }
        public async Task <ProductResponse> Handle(CreateProductCommand request, CancellationToken cancellationToken)
        {
            var dto     = mapper.Map <ProductDto>(request.Request);
            var created = await productRepository.Create(dto);

            await eventNotifier.Notify(new ProductCreated
            {
                Key = created.Key
            });

            return(mapper.Map <ProductResponse>(created));
        }
示例#3
0
        public ActionResult Index()
        {
            _eventNotifier.Notify <ITestEvent>(e => e.Talk("Bark!"));

            var contentItem = _contentManager.New("Foo");

            contentItem.As <TestContentPartA>().Line = "Orchard VNext Rocks";
            _contentManager.Create(contentItem);

            var retrieveContentItem = _contentManager.Get(contentItem.Id);
            var lineToSay           = retrieveContentItem.As <TestContentPartA>().Line;

            return(View("Index", _testDependency.SayHi(lineToSay)));
        }
 public void Activate()
 {
     _eventHandledNotifierFlow = _eventHandledNotifierContextSeq
                                 .Select(context => Observable.FromAsync(async() =>
     {
         try
         {
             await _eventNotifier.Notify(context);
             _logger.LogDebug(_l[L001SuccessToNotify], context.Event.Version);
         }
         catch (Exception e)
         {
             _logger.LogError(e, _l[L002FailToNotify], context.Event.Version);
         }
     }))
                                 .Concat()
                                 .Subscribe();
 }
 public void Activate()
 {
     _eventHandledNotifierFlow = _eventHandledNotifierContextSeq
                                 .Select(context => Observable.FromAsync(async() =>
     {
         try
         {
             await _eventNotifier.Notify(context);
             _logger.LogDebug(_l[LK.success_to_notify_about_event_be_handled__event_version____version_],
                              context.Event.Version);
         }
         catch (Exception e)
         {
             _logger.LogError(e, _l[LK.failed_to_notify_about_event_be_handled__event_version____version_],
                              context.Event.Version);
         }
     }))
                                 .Concat()
                                 .Subscribe();
 }