Exemple #1
0
        void OnInstanceDeleted(AwaitableEvent <GlobalDeleteEventArgs> ev)
        {
            Logger.Debug("Instance saved. Initiating publish checks.");

            var type     = ev.Args.EntityType;
            var instance = ev.Args.Entity;

            if (!DependenciesEnitityTypes.Contains(type))
            {
                Logger.Debug("Publish aborted: " + type.Name + " is not of type " + DomainType.Name);
                return;
            }

            ev.Do(async() =>
            {
                if (type == typeof(TDomain))
                {
                    await Publish(instance as TDomain, toDelete: true);
                }
                else
                {
                    await
                        (await FindRelationsOf(instance))
                    .ExceptNull()
                    .Do(async p => await Publish(p));
                }
            });
        }
        async Task OnInstanceDeleted(GlobalDeleteEventArgs eventArg)
        {
            Logger.Debug("Instance saved. Initiating publish checks.");

            if (!DependenciesEnitityTypes.Contains(eventArg.EntityType))
            {
                Logger.Debug("Publish aborted: " + eventArg.EntityType.Name + " is not of type " + DomainType.Name);
                return;
            }

            if (eventArg.EntityType == typeof(TDomain))
            {
                if (IsSoftDeleteEnabled)
                {
                    await Publish(eventArg.Entity as TDomain, toDelete : true);
                }
            }
            else
            {
                await
                    (await FindRelationsOf(eventArg.Entity))
                .ExceptNull()
                .Do(async p => await Publish(p));
            }
        }
Exemple #3
0
        void OnInstanceSaved(AwaitableEvent <GlobalSaveEventArgs> ev)
        {
            var item = ev.Args.Entity;

            Logger.Debug("Instance saved. Initiating publish checks.");

            if (!DependenciesEnitityTypes.Contains(item.GetType()))
            {
                Logger.Debug("Publish aborted: " + item.GetType().Name + " is not of type " + DomainType.Name);
                return;
            }

            ev.Do(async() =>
            {
                if (item is TDomain entity)
                {
                    await Publish(entity);
                }
                else if (item != null)
                {
                    await
                        (await FindRelationsOf(item))
                    .ExceptNull()
                    .Do(async p => await Publish(p));
                }
            });
        }
        async Task OnInstanceSaved(IEntity item)
        {
            Logger.Debug("Instance saved. Initiating publish checks.");

            if (!DependenciesEnitityTypes.Contains(item.GetType()))
            {
                Logger.Debug("Publish aborted: " + item.GetType().Name + " is not of type " + DomainType.Name);
                return;
            }

            if (item is TDomain entity)
            {
                await Publish(entity);
            }
            else if (item != null)
            {
                await
                    (await FindRelationsOf(item))
                .ExceptNull()
                .Do(async p => await Publish(p));
            }
        }