private async Task PublishMarketSettingsChangedEvent
     (MarketSettings oldSettings, MarketSettings newSettings, string username, string correlationId, ChangeType changeType)
 {
     await _cqrsMessageSender.SendEvent(new MarketSettingsChangedEvent
     {
         Username          = username,
         ChangeType        = changeType,
         CorrelationId     = correlationId,
         EventId           = Guid.NewGuid().ToString(),
         Timestamp         = DateTime.UtcNow,
         OldMarketSettings = _convertService.Convert <MarketSettings, MarketSettingsContract>(oldSettings),
         NewMarketSettings = _convertService.Convert <MarketSettings, MarketSettingsContract>(newSettings),
     });
 }
 private async Task PublishCurrencyChangedEvent
     (Currency oldCurrency, Currency newCurrency, string username, string correlationId, ChangeType changeType)
 {
     await _cqrsMessageSender.SendEvent(new CurrencyChangedEvent()
     {
         Username      = username,
         ChangeType    = changeType,
         CorrelationId = correlationId,
         EventId       = Guid.NewGuid().ToString(),
         Timestamp     = DateTime.UtcNow,
         OldValue      = _convertService.Convert <Currency, CurrencyContract>(oldCurrency),
         NewValue      = _convertService.Convert <Currency, CurrencyContract>(newCurrency),
     });
 }
 private async Task PublishProductCategoryChangedEvent(ProductCategory oldCategory, ProductCategory newCategory,
                                                       string username, string correlationId, ChangeType changeType, string originalCategoryName = null)
 {
     await _cqrsMessageSender.SendEvent(new ProductCategoryChangedEvent()
     {
         Username             = username,
         ChangeType           = changeType,
         CorrelationId        = correlationId,
         EventId              = Guid.NewGuid().ToString(),
         Timestamp            = DateTime.UtcNow,
         OldValue             = _convertService.Convert <ProductCategory, ProductCategoryContract>(oldCategory),
         NewValue             = _convertService.Convert <ProductCategory, ProductCategoryContract>(newCategory),
         OriginalCategoryName = originalCategoryName,
     });
 }
Exemple #4
0
 private async Task SendEntityChangedEvent <TModel, TContract, TEvent>(TModel oldValue, TModel newValue,
                                                                       string username, string correlationId, ChangeType changeType)
     where TEvent : EntityChangedEvent <TContract>, new()
     where TModel : class
 {
     await _messageSender.SendEvent(new TEvent()
     {
         Username      = username,
         ChangeType    = changeType,
         CorrelationId = correlationId,
         EventId       = Guid.NewGuid().ToString(),
         Timestamp     = DateTime.UtcNow,
         OldValue      = _convertService.Convert <TModel, TContract>(oldValue),
         NewValue      = _convertService.Convert <TModel, TContract>(newValue),
     });
 }