コード例 #1
0
        /*
         *      public void Attach(IProjection projection)
         *      {
         *          if(this.Projection != null)
         *              throw new Exception("Collection wrapper already attached to projection");
         *
         *          this.Projection = projection;
         *      }
         */

        /// <summary>
        ///
        /// </summary>
        /// <param name="projection"></param>
        /// <param name="bEnableNotifications"></param>
        public void Attach(IProjection projection, bool bEnableNotifications = true)
        {
            if (this.Projection != null)
            {
                throw new Exception("Collection wrapper already attached to projection");
            }

            this.Projection        = projection;
            this.NotifySubscribers = bEnableNotifications;
            projection.Observe(this);
        }
コード例 #2
0
        /// <summary>
        /// Attach a projection to the collection wrapper.
        /// </summary>
        /// <param name="projection"></param>
        /// <param name="enableNotifications">If true the wrapper will automatically send a notification
        /// for each Readmodel update. If false the caller can choose event per event if the notification
        /// shoudl be sent.</param>
        /// <param name="notifyOnlyLastEventOfCommit">This allow the collection wrapper to generate
        /// notification only if the event is the last event of the commit.</param>
        public void Attach(IProjection projection,
                           bool enableNotifications         = true,
                           bool notifyOnlyLastEventOfCommit = false)
        {
            if (this.Projection != null)
            {
                throw new CollectionWrapperException(FormatCollectionWrapperExceptionMessage("already attached to projection.", null));
            }

            Projection                  = projection;
            NotifySubscribers           = enableNotifications;
            NotifyOnlyLastEventOfCommit = notifyOnlyLastEventOfCommit;
            projection.Observe(this);
        }