示例#1
0
        public virtual async Task TriggerEntityCreatedEventOnUowCompletedAsync(object entity)
        {
            await TriggerEventWithEntity(
                LocalEventBus,
                typeof(EntityCreatedEventData <>),
                entity,
                entity,
                false
                );

            if (ShouldPublishDistributedEventForEntity(entity))
            {
                var eto = EntityToEtoMapper.Map(entity);
                if (eto != null)
                {
                    await TriggerEventWithEntity(
                        DistributedEventBus,
                        typeof(EntityCreatedEto <>),
                        eto,
                        entity,
                        false
                        );
                }
            }
        }
示例#2
0
    public virtual void PublishEntityCreatedEvent(object entity)
    {
        TriggerEventWithEntity(LocalEventBus, typeof(EntityCreatedEventData <>), entity, entity);

        if (ShouldPublishDistributedEventForEntity(entity))
        {
            var eto = EntityToEtoMapper.Map(entity);
            if (eto != null)
            {
                TriggerEventWithEntity(DistributedEventBus, typeof(EntityCreatedEto <>), eto, entity);
            }
        }
    }