コード例 #1
0
 public static void Handle(INotificationDispatcher dispatcher, IUserDatabase userDatabase, IInternalLocalUser localUser, IEpochTime epochTime)
 {
     dispatcher.OnAlertAdded += delegate(object sender, AbstractAddAlertNotificationEventArgs e)
     {
         HandleAlertAdded(localUser, userDatabase, e);
     };
     dispatcher.OnAlertCleared += delegate(object sender, AbstractClearAlertNotificationEventArgs e)
     {
         HandleAlertCleared(localUser, userDatabase, e);
     };
     dispatcher.OnFriendshipRemoved += delegate(object sender, AbstractRemoveFriendshipNotificationEventArgs e)
     {
         HandleFriendshipRemoved(userDatabase, localUser, e);
     };
     dispatcher.OnFriendshipTrustRemoved += delegate(object sender, AbstractRemoveFriendshipTrustNotificationEventArgs e)
     {
         HandleFriendshipTrustRemoved(userDatabase, localUser, e);
     };
     dispatcher.OnFriendshipInvitationAdded += delegate(object sender, AbstractAddFriendshipInvitationNotificationEventArgs e)
     {
         HandleFriendshipInvitationAdded(userDatabase, localUser, e);
     };
     dispatcher.OnFriendshipInvitationRemoved += delegate(object sender, AbstractRemoveFriendshipInvitationNotificationEventArgs e)
     {
         HandleFriendshipInvitationRemoved(userDatabase, localUser, e);
     };
     dispatcher.OnFriendshipAdded += delegate(object sender, AbstractAddFriendshipNotificationEventArgs e)
     {
         HandleFriendshipAdded(userDatabase, localUser, e);
     };
 }
コード例 #2
0
 public NotificationJobsHandlerCron(
     INotificationJobRepository notificationJobRepository,
     INotificationDispatcher notificationDispatcher)
 {
     _notificationJobRepository = notificationJobRepository;
     _notificationDispatcher    = notificationDispatcher;
 }
コード例 #3
0
        public static void CreateDispatcher(IServiceCollection services)
        {
            if (null != services)
            {
                INameResolver nameResolver = null;
                IOptions <EventSourcingOnAzureOptions> options = null;
                ILogger logger = null;

                var provider = services.BuildServiceProvider();
                using (var scope = provider.CreateScope())
                {
                    nameResolver = scope.ServiceProvider.GetRequiredService <INameResolver>();
                    IConfiguration configuration = scope.ServiceProvider.GetRequiredService <IConfiguration> ();
                    if (null != configuration)
                    {
                        EventSourcingOnAzureOptions optionConfig = new EventSourcingOnAzureOptions(configuration);
                        options = Options.Create <EventSourcingOnAzureOptions>(optionConfig);
                        if (null == nameResolver)
                        {
                            // make a default name resolver
                            nameResolver = new NotificationDispatcherNameResolver(configuration);
                        }
                    }
                }

                if (null == options)
                {
                    // make a default
                }

                NotificationDispatcher = new NotificationHelper(options, nameResolver, logger);
            }
        }
コード例 #4
0
 public SessionFactory(AbstractLogger logger, ICoroutineManager coroutineManager, IStopwatch pollCountdownStopwatch, IEpochTime epochTime, DatabaseCorruptionHandler databaseCorruptionHandler, INotificationQueue notificationQueue, INotificationDispatcher notificationDispatcher, ISessionStatus sessionStatus, IMixWebCallFactoryFactory mixWebCallFactoryFactory, IWebCallEncryptorFactory webCallEncryptorFactory, IMixSessionStarter mixSessionStarter, IKeychain keychain, ISessionRefresherFactory sessionRefresherFactory, IGuestControllerClientFactory guestControllerClientFactory, IRandom random, IEncryptor encryptor, IFileSystem fileSystem, IWwwCallFactory wwwCallFactory, string localStorageDirPath, string clientVersion, IDatabaseDirectoryCreator databaseDirectoryCreator, IDocumentCollectionFactory documentCollectionFactory, IDatabase database)
 {
     this.logger                       = logger;
     this.coroutineManager             = coroutineManager;
     this.pollCountdownStopwatch       = pollCountdownStopwatch;
     this.epochTime                    = epochTime;
     this.databaseCorruptionHandler    = databaseCorruptionHandler;
     this.notificationQueue            = notificationQueue;
     this.notificationDispatcher       = notificationDispatcher;
     this.sessionStatus                = sessionStatus;
     this.mixWebCallFactoryFactory     = mixWebCallFactoryFactory;
     this.webCallEncryptorFactory      = webCallEncryptorFactory;
     this.mixSessionStarter            = mixSessionStarter;
     this.keychain                     = keychain;
     this.sessionRefresherFactory      = sessionRefresherFactory;
     this.guestControllerClientFactory = guestControllerClientFactory;
     this.random                       = random;
     this.encryptor                    = encryptor;
     this.fileSystem                   = fileSystem;
     this.wwwCallFactory               = wwwCallFactory;
     this.localStorageDirPath          = localStorageDirPath;
     this.clientVersion                = clientVersion;
     this.databaseDirectoryCreator     = databaseDirectoryCreator;
     this.documentCollectionFactory    = documentCollectionFactory;
     this.database                     = database;
 }
コード例 #5
0
ファイル: VoteService.cs プロジェクト: n1ghtmare/Kauntr
 public VoteService(IVoteRepository voteRepository,
                    INotificationDispatcher notificationDispatcher,
                    IAccountRepository accountRepository,
                    ICountdownRepository countdownRepository) {
     _voteRepository = voteRepository;
     _notificationDispatcher = notificationDispatcher;
     _accountRepository = accountRepository;
     _countdownRepository = countdownRepository;
 }
コード例 #6
0
        public static bool HasObserver <T>(INotificationDispatcher sender, bool bNotifyEntity = false) where T : Notification
        {
            if (object.ReferenceEquals(sender, null))
            {
                throw new ArgumentNullException("sender");
            }

            return(sender.Observers.HasObserver <T>(bNotifyEntity));
        }
コード例 #7
0
 public UserController(IMethod _SMethod, IUser _SUser,
                       IMinio _SMinio, IMenu _SMenu, IUserInterest _SUserInterest,
                       INotificationDispatcher notificationDispatcher)
     : base(_SMethod)
 {
     this._SUser                 = _SUser;
     this._SMinio                = _SMinio;
     this._SMenu                 = _SMenu;
     this._SUserInterest         = _SUserInterest;
     this.notificationDispatcher = notificationDispatcher;
 }
コード例 #8
0
 public WeatherApiController(IMemoryCache cache,
                             IHttpClientFactory httpClientFactory,
                             IWeatherRepository weatherRepository,
                             INotificationDispatcher notificationDispatcher
                             )
 {
     _memoryCache            = cache;
     _httpClientFactory      = httpClientFactory;
     _weatherRepository      = weatherRepository;
     _notificationDispatcher = notificationDispatcher;
 }
コード例 #9
0
 public GitHubPaneViewModel(ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder,
                            IConnectionManager cm, IRepositoryHosts hosts, INotificationDispatcher notifications)
     : base(apiFactory, holder)
 {
     this.connectionManager = cm;
     this.hosts             = hosts;
     syncContext            = SynchronizationContext.Current;
     CancelCommand          = ReactiveCommand.Create();
     Title   = "GitHub";
     Message = String.Empty;
 }
 internal void SetOwner(INotificationDispatcher owner)
 {
     _owner = owner;
     if (GameObjectUtil.IsGameObjectSource(_owner))
     {
         _ownerGameObject = GameObjectUtil.GetGameObjectFromSource(_owner).AddOrGetComponent <GameObjectNotificationDispatcher>();
     }
     else
     {
         _ownerGameObject = null;
     }
 }
コード例 #11
0
        public NotifyIconWindow(INotificationDispatcher notificationDispatcher, IHistoryMenuViewModel historyMenuViewModel)
        {
            _notificationDispatcher = notificationDispatcher;
            _historyMenuViewModel   = historyMenuViewModel;

            InitializeComponent();
            HistoryMenu.DataContext = _historyMenuViewModel;

            _notificationDispatcher.Subscribe(notification =>
            {
                ShowNotification(notification.Notification);
            });
        }
コード例 #12
0
        /// <summary>
        /// Posts a notification of type T. Returns true if an observer was found and received the notification.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="sender"></param>
        /// <param name="notification"></param>
        /// <param name="bNotifyEntity"></param>
        /// <returns></returns>
        public static bool PostNotification <T>(INotificationDispatcher sender, T notification, bool bNotifyEntity = false) where T : Notification
        {
            if (sender == null)
            {
                throw new ArgumentNullException("sender");
            }
            if (notification == null)
            {
                throw new ArgumentNullException("notification");
            }

            return(sender.Observers.PostNotification <T>(notification, bNotifyEntity));
        }
コード例 #13
0
        public static void RemoveObserver <T>(INotificationDispatcher sender, NotificationHandler <T> handler) where T : Notification
        {
            if (object.ReferenceEquals(sender, null))
            {
                throw new System.ArgumentNullException("sender");
            }
            if (handler == null)
            {
                throw new System.ArgumentNullException("handler");
            }

            sender.Observers.RemoveObserver <T>(handler);
        }
コード例 #14
0
        public static bool HasObserver(System.Type notificationType, INotificationDispatcher sender, bool bNotifyEntity = false)
        {
            if (notificationType == null || !TypeUtil.IsType(notificationType, typeof(Notification)))
            {
                throw new TypeArgumentMismatchException(notificationType, typeof(Notification), "notificationType");
            }
            if (object.ReferenceEquals(sender, null))
            {
                throw new ArgumentNullException("sender");
            }

            return(sender.Observers.HasObserver(notificationType, bNotifyEntity));
        }
コード例 #15
0
        public static bool UnsafePostNotification(INotificationDispatcher sender, Notification notification, bool bNotifyEntity = false)
        {
            if (sender == null)
            {
                throw new ArgumentNullException("sender");
            }
            if (notification == null)
            {
                throw new ArgumentNullException("notification");
            }

            return(sender.Observers.UnsafePostNotification(notification, bNotifyEntity));
        }
コード例 #16
0
        public static void RegisterObserver <T>(INotificationDispatcher sender, NotificationHandler <T> handler) where T : Notification
        {
            if (sender == null)
            {
                throw new System.ArgumentNullException("sender");
            }
            if (handler == null)
            {
                throw new System.ArgumentNullException("handler");
            }

            sender.Observers.RegisterObserver <T>(handler);
        }
コード例 #17
0
        public RepositoryPublishControl(ITeamExplorerServices teServices, INotificationDispatcher notifications)
        {
            InitializeComponent();

            this.WhenActivated(d =>
            {
                d(this.BindCommand(ViewModel, vm => vm.PublishRepository, v => v.publishRepositoryButton));

                ViewModel.PublishRepository.Subscribe(state =>
                {
                    if (state == ProgressState.Success)
                    {
                        teServices.ShowMessage(UI.Resources.RepositoryPublishedMessage);
                        NotifyDone();
                    }
                });

                d(this.WhenAny(x => x.ViewModel.IsPublishing, x => x.Value)
                  .Subscribe(x => NotifyIsBusy(x)));


                d(notifications.Listen()
                  .Where(n => n.Type == Notification.NotificationType.Error)
                  .Subscribe(n => teServices.ShowError(n.Message)));

                d(this.WhenAny(x => x.ViewModel.SafeRepositoryNameWarningValidator.ValidationResult, x => x.Value)
                  .WhereNotNull()
                  .Select(result => result?.Message)
                  .Subscribe(message =>
                {
                    if (!String.IsNullOrEmpty(message))
                    {
                        teServices.ShowWarning(message);
                    }
                    else
                    {
                        teServices.ClearNotifications();
                    }
                }));

                nameText.Text = ViewModel.DefaultRepositoryName;
            });
            IsVisibleChanged += (s, e) =>
            {
                if (IsVisible)
                {
                    this.TryMoveFocus(FocusNavigationDirection.First).Subscribe();
                }
            };
        }
コード例 #18
0
        public EventStream(EventStreamAttribute attribute,
                           IWriteContext context              = null,
                           IEventStreamSettings settings      = null,
                           INotificationDispatcher dispatcher = null
                           )
        {
            _domainName     = attribute.DomainName;
            _entityTypeName = attribute.EntityTypeName;
            _instanceKey    = attribute.InstanceKey;


            if (null == settings)
            {
                _settings = new EventStreamSettings();
            }
            else
            {
                _settings = settings;
            }

            // wire up the event stream writer
            _writer = _settings.CreateWriterForEventStream(attribute);

            if (null != context)
            {
                _context = context;
                if (null != _writer)
                {
                    _writer.SetContext(_context);
                }
            }

            if (null == dispatcher)
            {
                if (!string.IsNullOrWhiteSpace(attribute.NotificationDispatcherName))
                {
                    _notificationDispatcher = NotificationDispatcherFactory.GetDispatcher(attribute.NotificationDispatcherName);
                }
                else
                {
                    // Create a new dispatcher
                    _notificationDispatcher = NotificationDispatcherFactory.GetDefaultDispatcher();
                }
            }
            else
            {
                _notificationDispatcher = dispatcher;
            }
        }
コード例 #19
0
ファイル: PriceUpdaterCron.cs プロジェクト: daver32/Steamboat
 public PriceUpdaterCron(
     IAppRepository appRepository,
     INotificationDispatcher notificationDispatcher,
     IPriceUpdaterConfigProvider configProvider,
     ILoopIdStore loopIdStore,
     IGuidProvider guidProvider,
     IAppPricesUpdater appPricesUpdater)
 {
     _appRepository          = appRepository;
     _notificationDispatcher = notificationDispatcher;
     _configProvider         = configProvider;
     _loopIdStore            = loopIdStore;
     _guidProvider           = guidProvider;
     _appPricesUpdater       = appPricesUpdater;
 }
        // 需要模拟用户令牌
        // 是否有必要
        // private readonly ICurrentPrincipalAccessor _currentPrincipalAccessor;
        public UserCreateSendWelcomeEventHandler(
            ISettingProvider settingProvider,
            INotificationStore notificationStore,
            INotificationDispatcher notificationDispatcher,
            IStringLocalizer <MessageServiceResource> stringLocalizer
            //ICurrentPrincipalAccessor currentPrincipalAccessor
            )
        {
            _settingProvider        = settingProvider;
            _stringLocalizer        = stringLocalizer;
            _notificationStore      = notificationStore;
            _notificationDispatcher = notificationDispatcher;

            //_currentPrincipalAccessor = currentPrincipalAccessor;
        }
 public TenantCreateEventHandler(
     ICurrentTenant currentTenant,
     ISettingProvider settingProvider,
     INotificationDispatcher notificationDispatcher,
     INotificationSubscriptionManager notificationSubscriptionManager,
     IStringLocalizer <MessageServiceResource> stringLocalizer,
     ILogger <TenantCreateEventHandler> logger)
 {
     Logger                          = logger;
     CurrentTenant                   = currentTenant;
     SettingProvider                 = settingProvider;
     StringLocalizer                 = stringLocalizer;
     NotificationDispatcher          = notificationDispatcher;
     NotificationSubscriptionManager = notificationSubscriptionManager;
 }
コード例 #22
0
        /// <summary>
        /// Create the projection from the attribute linked to the function parameter
        /// </summary>
        /// <param name="attribute">
        /// The attribute describing which projection to run
        /// </param>
        public Classification(ClassificationAttribute attribute,
                              IEventStreamSettings settings                = null,
                              INotificationDispatcher dispatcher           = null,
                              IClassificationSnapshotReader snapshotReader = null,
                              IClassificationSnapshotWriter snapshotWriter = null)
        {
            _domainName         = attribute.DomainName;
            _entityTypeName     = attribute.EntityTypeName;
            _instanceKey        = attribute.InstanceKey;
            _classifierTypeName = attribute.ClassifierTypeName;


            if (null == settings)
            {
                _settings = new EventStreamSettings();
            }
            else
            {
                _settings = settings;
            }

            _connectionStringName = _settings.GetConnectionStringName(attribute);

            if (null == _classificationProcessor)
            {
                _classificationProcessor = _settings.CreateClassificationProcessorForEventStream(attribute);
            }

            if (null == dispatcher)
            {
                // Create a new dispatcher
                _notificationDispatcher = NotificationDispatcherFactory.NotificationDispatcher;
            }
            else
            {
                _notificationDispatcher = dispatcher;
            }

            if (null != snapshotReader)
            {
                _snapshotReader = snapshotReader;
            }

            if (null != snapshotWriter)
            {
                _snapshotWriter = snapshotWriter;
            }
        }
        /// <summary>
        /// Create a new event stream from the attribute passed in
        /// </summary>
        /// <param name="attribute">
        /// The EventStreamAttribute tagging the parameter to crreate by dependency injection
        /// </param>
        /// <param name="context">
        /// The context within which this binding is occuring
        /// </param>
        /// <returns>
        /// A task that can create an event stream when required
        /// </returns>
        public static Task <EventStream> BuildEventStreamFromAttribute(EventStreamAttribute attribute,
                                                                       ValueBindingContext context)
        {
            // If possible get the event stream settings to use

            // If possible, get the write context to use
            IWriteContext writeContext = WriteContext.CreateFunctionContext(context.FunctionContext);

            // If possible, get the notification dipatcher to use
            INotificationDispatcher dispatcher = NotificationDispatcherFactory.NotificationDispatcher;

            // Use this and the attribute to create a new event stream instance
            return(Task <EventStream> .FromResult(new EventStream(attribute,
                                                                  context : writeContext,
                                                                  dispatcher : dispatcher )));
        }
コード例 #24
0
        public GitHubPaneViewModel(ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder,
            IConnectionManager cm, IRepositoryHosts hosts, INotificationDispatcher notifications)
            : base(apiFactory, holder)
        {
            this.connectionManager = cm;
            this.hosts = hosts;
            syncContext = SynchronizationContext.Current;
            CancelCommand = ReactiveCommand.Create();
            Title = "GitHub";
            Message = String.Empty;

            this.WhenAnyValue(x => x.Control.DataContext)
                .OfType<BaseViewModel>()
                .Select(x => x.WhenAnyValue(y => y.Title))
                .Switch()
                .Subscribe(x => Title = x ?? "GitHub");
        }
コード例 #25
0
        public GitHubPaneViewModel(ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder,
                                   IConnectionManager cm, IRepositoryHosts hosts, INotificationDispatcher notifications)
            : base(apiFactory, holder)
        {
            this.connectionManager = cm;
            this.hosts             = hosts;
            syncContext            = SynchronizationContext.Current;
            CancelCommand          = ReactiveCommand.Create();
            Title   = "GitHub";
            Message = String.Empty;

            this.WhenAnyValue(x => x.Control.DataContext)
            .OfType <BaseViewModel>()
            .Select(x => x.WhenAnyValue(y => y.Title))
            .Switch()
            .Subscribe(x => Title = x ?? "GitHub");
        }
コード例 #26
0
        public CopypastaController(IClipboard clipboard, IClipboardHistoryManager clipboardHistoryManager,
                                   IClipboardBindingManager clipboardBindingManager, IHotkey ctrlVHotkey, IHotkey ctrlCHotkey, IHotkey escHotkey,
                                   IKeyTracker keyTracker, IInputSimulator inputSimulator, INotificationDispatcher notificationDispatcher)
        {
            _clipboard = clipboard;
            _clipboardHistoryManager = clipboardHistoryManager;
            _clipboardBindingManager = clipboardBindingManager;
            _ctrlVHotkey             = ctrlVHotkey;
            _ctrlCHotkey             = ctrlCHotkey;
            _escHotkey              = escHotkey;
            _keyTracker             = keyTracker;
            _inputSimulator         = inputSimulator;
            _notificationDispatcher = notificationDispatcher;
            _copypastaStateMachine  = new StateMachine <CopypastaState, CopypastaTrigger>(CopypastaState.Idle);
            _keyPressedTrigger      = _copypastaStateMachine.SetTriggerParameters <Key>(CopypastaTrigger.KeyPressed);

            ConfigureCopypastaStateMachine();
            ConfigureEventTriggers();
        }
コード例 #27
0
        public GistCreationControl(
            ITeamExplorerServices teServices,
            INotificationDispatcher notifications,
            [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider)
        {
            InitializeComponent();

            this.WhenActivated(d =>
            {
                errorMessage.Visibility = Visibility.Collapsed;

                d(this.Bind(ViewModel, vm => vm.Description, v => v.descriptionTextBox.Text));
                d(this.Bind(ViewModel, vm => vm.FileName, v => v.fileNameTextBox.Text));
                d(this.Bind(ViewModel, vm => vm.IsPrivate, v => v.makePrivate.IsChecked));
                d(this.BindCommand(ViewModel, vm => vm.CreateGist, v => v.createGistButton));

                d(this.Bind(ViewModel, vm => vm.Account, v => v.accountStackPanel.DataContext));

                ViewModel.CreateGist
                .Where(x => x != null)
                .Subscribe(gist =>
                {
                    var browser = serviceProvider.GetExportedValue <IVisualStudioBrowser>();
                    browser?.OpenUrl(new Uri(gist.HtmlUrl));

                    var ns = serviceProvider.GetExportedValue <IStatusBarNotificationService>();
                    ns?.ShowMessage(UI.Resources.gistCreatedMessage);

                    NotifyDone();
                });

                d(notifications.Listen()
                  .Where(n => n.Type == Notification.NotificationType.Error)
                  .ObserveOnDispatcher(DispatcherPriority.Normal)
                  .Subscribe(n =>
                {
                    errorMessage.Visibility = Visibility.Visible;
                    errorMessageText.Text   = n.Message;
                }));
            });
        }
コード例 #28
0
 public EventController(IMethod _SMethod,
                        IEvent _SEvent, IMinio _SMinio,
                        IUser _SUser, IEventDetail _SEventDetail, IEventParticipant _SEventParticipant,
                        IEventCategory _SEventCategory, ICategory _SCategory, IEventSponsor _SEventSponsor,
                        ISponsor _SSponsor, IUserInterest _SUserInterest,
                        INotificationDispatcher notificationDispatcher
                        )
     : base(_SMethod)
 {
     this._SEvent                = _SEvent;
     this._SMinio                = _SMinio;
     this._SUser                 = _SUser;
     this._SEventDetail          = _SEventDetail;
     this._SEventParticipant     = _SEventParticipant;
     this._SEventCategory        = _SEventCategory;
     this._SCategory             = _SCategory;
     this._SEventSponsor         = _SEventSponsor;
     this._SSponsor              = _SSponsor;
     this._SUserInterest         = _SUserInterest;
     this.notificationDispatcher = notificationDispatcher;
 }
コード例 #29
0
        public static void UnsafeRemoveObserver(System.Type notificationType, INotificationDispatcher sender, NotificationHandler handler)
        {
            if (notificationType == null)
            {
                throw new System.ArgumentNullException("notificationType");
            }
            if (!TypeUtil.IsType(notificationType, typeof(Notification)))
            {
                throw new TypeArgumentMismatchException(notificationType, typeof(Notification), "notificationType");
            }
            if (object.ReferenceEquals(sender, null))
            {
                throw new System.ArgumentNullException("sender");
            }
            if (handler == null)
            {
                throw new System.ArgumentNullException("handler");
            }

            sender.Observers.UnsafeRemoveObserver(notificationType, handler);
        }
コード例 #30
0
        public GitHubPaneView(INotificationDispatcher notifications)
        {
            InitializeComponent();

            this.WhenActivated(d =>
            {
                d(notifications.Listen()
                  .ObserveOnDispatcher(DispatcherPriority.Normal)
                  .Subscribe(n =>
                {
                    if (n.Type == Notification.NotificationType.Error || n.Type == Notification.NotificationType.Warning)
                    {
                        infoPanel.Icon = Octicon.alert;
                    }
                    else
                    {
                        infoPanel.Icon = Octicon.info;
                    }
                    infoPanel.Message = n.Message;
                }));
            });
        }
コード例 #31
0
 public GitHubPaneView(INotificationDispatcher notifications)
 {
     this.InitializeComponent();
     this.WhenActivated(d =>
     {
         infoPanel.Visibility = Visibility.Collapsed;
         d(notifications.Listen()
           .ObserveOnDispatcher(DispatcherPriority.Normal)
           .Subscribe(n =>
         {
             if (n.Type == Notification.NotificationType.Error || n.Type == Notification.NotificationType.Warning)
             {
                 infoPanel.MessageType = MessageType.Warning;
             }
             else
             {
                 infoPanel.MessageType = MessageType.Information;
             }
             infoPanel.Message = n.Message;
         }));
     });
 }
コード例 #32
0
        /// <summary>
        /// Create the projection from the attribute linked to the function parameter
        /// </summary>
        /// <param name="attribute">
        /// The attribute describing which projection to run
        /// </param>
        public Projection(ProjectionAttribute attribute,
                          IEventStreamSettings settings      = null,
                          INotificationDispatcher dispatcher = null)
        {
            _domainName         = attribute.DomainName;
            _entityTypeName     = attribute.EntityTypeName;
            _instanceKey        = attribute.InstanceKey;
            _projectionTypeName = attribute.ProjectionTypeName;


            if (null == settings)
            {
                _settings = new EventStreamSettings();
            }
            else
            {
                _settings = settings;
            }

            _connectionStringName = _settings.GetConnectionStringName(attribute);

            if (null == _projectionProcessor)
            {
                _projectionProcessor = _settings.CreateProjectionProcessorForEventStream(attribute);
            }

            if (null == dispatcher)
            {
                // Create a new dispatcher
                _notificationDispatcher = NotificationDispatcherFactory.NotificationDispatcher;
            }
            else
            {
                _notificationDispatcher = dispatcher;
            }
        }