diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorListExtensions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorListExtensions.cs
index d2a0622f54..a9247bc28b 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorListExtensions.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorListExtensions.cs
@@ -26,7 +26,7 @@ namespace Volo.Abp.Domain.Entities.Events.Distributed
)
);
}
-
+
///
/// Adds a specific entity type and the types derived from that entity type.
///
@@ -49,14 +49,27 @@ namespace Volo.Abp.Domain.Entities.Events.Distributed
)
);
}
-
+
+ ///
+ /// Remove a specific entity type and the types derived from that entity type.
+ ///
+ /// Type of the entity
+ public static void Remove([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
+ where TEntity : IEntity
+ {
+ Check.NotNull(selectors, nameof(selectors));
+
+ var selectorName = "Entity:" + typeof(TEntity).FullName;
+ selectors.RemoveAll(s => s.Name == selectorName);
+ }
+
///
/// Adds all entity types.
///
public static void AddAll([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
{
Check.NotNull(selectors, nameof(selectors));
-
+
if (selectors.Any(s => s.Name == AllEntitiesSelectorName))
{
return;
@@ -72,11 +85,11 @@ namespace Volo.Abp.Domain.Entities.Events.Distributed
public static void Add(
[NotNull] this IAutoEntityDistributedEventSelectorList selectors,
- string selectorName,
+ string selectorName,
Func predicate)
{
Check.NotNull(selectors, nameof(selectors));
-
+
if (selectors.Any(s => s.Name == selectorName))
{
throw new AbpException($"There is already a selector added before with the same name: {selectorName}");
@@ -89,7 +102,7 @@ namespace Volo.Abp.Domain.Entities.Events.Distributed
)
);
}
-
+
public static void Add(
[NotNull] this IAutoEntityDistributedEventSelectorList selectors,
Func predicate)
@@ -103,15 +116,15 @@ namespace Volo.Abp.Domain.Entities.Events.Distributed
{
Check.NotNull(selectors, nameof(selectors));
Check.NotNull(name, nameof(name));
-
+
return selectors.RemoveAll(s => s.Name == name).Count > 0;
}
-
+
public static bool IsMatch([NotNull] this IAutoEntityDistributedEventSelectorList selectors, Type entityType)
{
Check.NotNull(selectors, nameof(selectors));
return selectors.Any(s => s.Predicate(entityType));
}
}
-}
\ No newline at end of file
+}