Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ValidatedDisbsadCommandHandler"/> class.
 /// </summary>
 /// <param name="query">The query<see cref="IQueryFlow{Disbsad}"/></param>
 /// <param name="writer">The writer<see cref="IProjectionWriter"/></param>
 /// <param name="applicationBuilder">The applicationBuilder<see cref="IApplicationBuilder"/></param>
 public ValidatedDisbsadCommandHandler(IQueryFlow <Disbsad> query, IProjectionWriter writer, IApplicationBuilder applicationBuilder)
 {
     this.query         = query;
     this.writer        = writer;
     coreKeyVaultClient = applicationBuilder?.ApplicationServices.GetRequiredService <ICoreKeyVaultClient>();
     validator          = new DisbsadValidator();
 }
 public static TEntity AddOrUpdate <TKey, TEntity>(this IProjectionWriter <TKey, TEntity> writer, TKey key, Func <TEntity> addFactory, Action <TEntity> update)
 {
     return(writer.AddOrUpdate(key, addFactory, entity =>
     {
         update(entity);
         return entity;
     }));
 }
 public static TEntity UpdateOrThrow <TKey, TEntity>(this IProjectionWriter <TKey, TEntity> writer, TKey key, Action <TEntity> change)
 {
     return(writer.AddOrUpdate(key, () =>
     {
         var txt = $"Failed to load '{typeof(TEntity).Name}' with key '{key}'.";
         throw new InvalidOperationException(txt);
     }, change));
 }
 public static TEntity Add <TKey, TEntity>(this IProjectionWriter <TKey, TEntity> writer, TKey key, TEntity newEntity)
 {
     return(writer.AddOrUpdate(key, newEntity, e =>
     {
         var txt = $"Entity '{typeof(TEntity).Name}' with key '{key}' should not exist.";
         throw new InvalidOperationException(txt);
     }));
 }
 public static TEntity AddOrUpdate <TKey, TEntity>(this IProjectionWriter <TKey, TEntity> writer, TKey key, TEntity newView, Action <TEntity> updateViewFactory)
 {
     return(writer.AddOrUpdate(key, () => newView, view =>
     {
         updateViewFactory(view);
         return view;
     }));
 }
Exemple #6
0
 public ProjectionPlayer(CronusContext context, IEventStore eventStore, IProjectionWriter projectionRepository, IProjectionReader projectionReader, IInitializableProjectionStore projectionStoreInitializer, EventToAggregateRootId index)
 {
     this.context                    = context;
     this.eventStore                 = eventStore;
     this.projectionWriter           = projectionRepository;
     this.projectionReader           = projectionReader;
     this.projectionStoreInitializer = projectionStoreInitializer;
     this.index = index;
 }
 public static TView UpdateEnforcingNew <TKey, TView>(this IProjectionWriter <TKey, TView> writer, TKey key,
                                                      Action <TView> update)
     where TView : new()
 {
     return(writer.AddOrUpdate(key, () =>
     {
         var view = new TView();
         update(view);
         return view;
     }, v =>
     {
         update(v);
         return v;
     }));
 }
Exemple #8
0
        private static Func <IEnumerable <IProjectionWriter <DocumentAudit> >, IProjectionManager <DocumentAudit> > DocumentAuditProjectionManagerFactory(IServiceProvider serviceProvider)
        {
            return(new Func <IEnumerable <IProjectionWriter <DocumentAudit> >, IProjectionManager <DocumentAudit> >(writers =>
            {
                var tempWriters = new IProjectionWriter <Audit> [writers.Count()];

                var i = 0;

                foreach (var temp in writers)
                {
                    tempWriters[i] = (IProjectionWriter <Audit>)temp;
                }

                return new DocumentAuditProjectionManager(serviceProvider.GetRequiredService <ILogger <ProjectionManager <DocumentAudit> > >(), tempWriters);
            }));
        }
 public OrdersObserver(IProjectionWriter writer)
 {
     this.writer = writer;
 }
Exemple #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ValidatedFpnCommandHandler"/> class.
 /// </summary>
 /// <param name="query">The query<see cref="IQueryFlow{Fpn}"/></param>
 /// <param name="writer">The writer<see cref="IProjectionWriter"/></param>
 /// <param name="applicationBuilder">The applicationBuilder<see cref="IApplicationBuilder"/></param>
 public ValidatedFpnCommandHandler(IQueryFlow <Fpn> query, IProjectionWriter writer, IApplicationBuilder applicationBuilder)
 {
     _query              = query;
     _writer             = writer;
     _coreKeyVaultClient = applicationBuilder?.ApplicationServices.GetRequiredService <ICoreKeyVaultClient>();
 }
Exemple #11
0
 public InvestorProjectionEventHandler(IProjectionWriter projectionWriter)
 {
     _projectionWriter = projectionWriter;
 }
Exemple #12
0
 protected QueryListener(IProjectionWriter writer)
 {
     Writer = writer;
 }
 public static async Task Add <TId, TView>(this IProjectionWriter <TId, TView> writer, TId key, TView item) where TView : class
 {
     await writer.AddOrUpdate(key, () => item, null, false);
 }
 public static async Task Update <TId, TView>(this IProjectionWriter <TId, TView> writer, TId key, Func <TView, TView> update) where TView : class
 {
     await writer.AddOrUpdate(key, null, update);
 }
Exemple #15
0
 public ProjectsObserver(IProjectionWriter <Guid, ProjectsView> writer)
 {
     _writer = writer;
 }
 public static async Task Update <TId, TView>(this IProjectionWriter <TId, TView> writer, TId key, Action <TView> update) where TView : class
 {
     await writer.AddOrUpdate(key, null, x => { update(x); return(x); });
 }
Exemple #17
0
 public OnlyActiveUserProjections(IProjectionStore store)
 {
     _store = store.GetWriter <Guid, ActiveUserView>();
 }
 public static async Task UpdateEnforcingNew <TId, TView>(this IProjectionWriter <TId, TView> writer, TId key, Action <TView> update)
     where TView : class, new()
 {
     await writer.AddOrUpdate(key, () => new TView(), x => { update(x); return(x); });
 }
Exemple #19
0
 public GroupCreatedListener(IProjectionWriter writer) : base(writer)
 {
 }
Exemple #20
0
 public MyEntityCreatedEventHandler(IProjectionWriter elasticSearchProjectionWriter)
 {
     this._elasticSearchProjectionWriter = elasticSearchProjectionWriter;
 }
 public SamplesObserver(IProjectionWriter<Guid, SampleView> writer)
 {
     _writer = writer;
 }
 public BuyOrderProjectionEventHandler(IProjectionWriter projectionWriter)
 {
     _projectionWriter = projectionWriter;
 }
 public TaskStatusSetListener(IProjectionWriter writer) : base(writer)
 {
 }
Exemple #24
0
 public AccountRegisteredListener(IProjectionWriter writer) : base(writer)
 {
 }
Exemple #25
0
 public RegionChosenListener(IProjectionWriter writer) : base(writer)
 {
 }
 public GroupAddedToRegionListener(IProjectionWriter writer) : base(writer)
 {
 }
Exemple #27
0
 public GroupDetailObserver(IProjectionWriter <GroupDetailProjection> projectionWriter)
 {
     _projectionWriter = projectionWriter;
 }
 public RegionCreatedListener(IProjectionWriter writer) : base(writer)
 {
 }
Exemple #29
0
 public BuddyCreatedListener(IProjectionWriter writer) : base(writer)
 {
 }
 public GroupLeftListener(IProjectionWriter writer) : base(writer)
 {
 }
 public static async Task Add <TId, TView>(this IProjectionWriter <TId, TView> writer, TId key, Func <TView> addFactory) where TView : class
 {
     await writer.AddOrUpdate(key, addFactory, null, false);
 }