Esempio n. 1
0
        public virtual void Handle(TMessage message, IProvideProjections store)
        {
            Logger.DebugFormat("Remove projections because of a message: {0}", message);
            var filterValues = GetFilterValues(message);

            Remove(store, filterValues);
        }
Esempio n. 2
0
        public virtual void Handle(TMessage message, IProvideProjections store)
        {
            var translatedMessages = Translate(message);

            foreach (var translatedMessage in translatedMessages)
            {
                Handle(translatedMessage, store);
            }
        }
Esempio n. 3
0
        public virtual void Handle(TMessage message, IProvideProjections store)
        {
            Logger.DebugFormat("Insert a projection because of a message: {0}", message);

            var projection = new TProjection();

            Map(message, projection);
            Insert(store, projection);
        }
Esempio n. 4
0
 private static void Remove(IProvideProjections store, IEnumerable <FilterValue> filterValues)
 {
     Logger.Debug("Remove projections.");
     try
     {
         store.Remove <TProjection>(filterValues);
     }
     catch (Exception e)
     {
         Logger.ErrorException("Failed to remove projections.", e);
         throw;
     }
 }
Esempio n. 5
0
 private static void Insert(IProvideProjections store, TProjection projection)
 {
     Logger.DebugFormat("Insert a projection: {0}", projection);
     try
     {
         store.Insert(projection);
     }
     catch (Exception e)
     {
         Logger.ErrorException("Failed to insert a projection.", e);
         throw;
     }
 }
Esempio n. 6
0
 private static void Update(IProvideProjections store, TProjection projection)
 {
     Logger.DebugFormat("Update a projection: {0}", projection);
     try
     {
         store.Update(projection);
     }
     catch (Exception e)
     {
         Logger.ErrorException("Failed to update a projection.", e);
         throw;
     }
 }
Esempio n. 7
0
 private static TProjection Read(IProvideProjections store, IEnumerable <FilterValue> filterValues)
 {
     Logger.Debug("Read a projection.");
     try
     {
         return(store.Read <TProjection>(filterValues).SingleOrDefault());
     }
     catch (Exception e)
     {
         Logger.ErrorException("Failed to read a projection.", e);
         throw;
     }
 }
Esempio n. 8
0
 private void Handle(TTranslatedMessage message, IProvideProjections store)
 {
     Logger.DebugFormat("Handle a translated message: {0}", message);
     try
     {
         _strategy.Handle(message, store);
     }
     catch (Exception e)
     {
         Logger.ErrorException("Failed to handle translated message.", e);
         throw;
     }
 }
Esempio n. 9
0
        public virtual void Handle(TMessage message, IProvideProjections store)
        {
            Logger.DebugFormat("Update projection(s) because of a message: {0}", message);

            var filterValues = GetFilterValues(message);
            var projections  = Read(store, filterValues);

            foreach (var projection in projections)
            {
                Logger.DebugFormat("A projection found: {0}", projection);

                Map(message, projection);
                Update(store, projection);
            }
        }
Esempio n. 10
0
        public virtual void Handle(TMessage message, IProvideProjections store)
        {
            Logger.DebugFormat("Save a projection because of a message: {0}", message);

            var filterValues = GetFilterValues(message);
            var projection   = Read(store, filterValues);

            if (projection == null)
            {
                Logger.Debug("No projections found.");

                projection = new TProjection();
                MapKeys(message, projection);
                Map(message, projection);
                Insert(store, projection);
            }

            Logger.DebugFormat("A projection found: {0}", projection);

            Map(message, projection);
            Update(store, projection);
        }
Esempio n. 11
0
 public void Handle(TMessage message, IProvideProjections store)
 {
 }
Esempio n. 12
0
 public void Handle(TestMessage message, IProvideProjections store)
 {
     Counter++;
 }
Esempio n. 13
0
 public TestProvidersFactory(IProvideProjections provider)
 {
     _provider = provider;
 }
 public void Handle(TMessage message, IProvideProjections projections)
 {
     EnsureStrategy();
     _strategy.Handle(message, projections);
 }