AutoEntityDistributedEventSelectorListExtensions

We found 5 examples in language CSharp for this search. You will see 30 fragments of code.

        public static void AddNamespace([NotNull] this IAutoEntityDistributedEventSelectorList selectors, [NotNull] string namespaceName)
        {
            Check.NotNull(selectors, nameof(selectors));

            var selectorName = "Namespace:" + namespaceName;
            if (selectors.Any(s => s.Name == selectorName))
            {
                return;
            }

            selectors.Add(
                new NamedTypeSelector(
                    selectorName,
                    t => t.FullName?.StartsWith(namespaceName) ?? false
                )
            );
        }

        /// <summary>
        /// Adds a specific entity type and the types derived from that entity type.
        /// </summary>
        /// <typeparam name="TEntity">Type of the entity</typeparam>
        public static void Add<TEntity>([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
            where TEntity : IEntity
        {
            Check.NotNull(selectors, nameof(selectors));

            var selectorName = "Entity:" + typeof(TEntity).FullName;
            if (selectors.Any(s => s.Name == selectorName))
            {
                return;
            }

            selectors.Add(
                new NamedTypeSelector(
                    selectorName,
                    t => typeof(TEntity).IsAssignableFrom(t)
                )
            );
        }

        /// <summary>
        /// Remove a specific entity type and the types derived from that entity type.
        /// </summary>
        /// <typeparam name="TEntity">Type of the entity</typeparam>
        public static void Remove<TEntity>([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
            where TEntity : IEntity
        {
            Check.NotNull(selectors, nameof(selectors));

            var selectorName = "Entity:" + typeof(TEntity).FullName;
            selectors.RemoveAll(s => s.Name == selectorName);
        }

        /// <summary>
        /// Adds all entity types.
        /// </summary>
        public static void AddAll([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
        {
            Check.NotNull(selectors, nameof(selectors));

            if (selectors.Any(s => s.Name == AllEntitiesSelectorName))
            {
                return;
            }

            selectors.Add(
                new NamedTypeSelector(
                    AllEntitiesSelectorName,
                    t => typeof(IEntity).IsAssignableFrom(t)
                )
            );
        }

        public static void Add(
            [NotNull] this IAutoEntityDistributedEventSelectorList selectors,
            string selectorName,
            Func<Type, bool> 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}");
            }

            selectors.Add(
                new NamedTypeSelector(
                    selectorName,
                    predicate
                )
            );
        }

        public static void Add(
            [NotNull] this IAutoEntityDistributedEventSelectorList selectors,
            Func<Type, bool> predicate)
        {
            selectors.Add(Guid.NewGuid().ToString("N"), predicate);
        }


        public static void AddNamespace([NotNull] this IAutoEntityDistributedEventSelectorList selectors, [NotNull] string namespaceName)
        {
            Check.NotNull(selectors, nameof(selectors));

            var selectorName = "Namespace:" + namespaceName;
            if (selectors.Any(s => s.Name == selectorName))
            {
                return;
            }

            selectors.Add(
                new NamedTypeSelector(
                    selectorName,
                    t => t.FullName?.StartsWith(namespaceName) ?? false
                )
            );
        }

        /// <summary>
        /// Adds a specific entity type and the types derived from that entity type.
        /// </summary>
        /// <typeparam name="TEntity">Type of the entity</typeparam>
        public static void Add<TEntity>([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
            where TEntity : IEntity
        {
            Check.NotNull(selectors, nameof(selectors));

            var selectorName = "Entity:" + typeof(TEntity).FullName;
            if (selectors.Any(s => s.Name == selectorName))
            {
                return;
            }

            selectors.Add(
                new NamedTypeSelector(
                    selectorName,
                    t => typeof(TEntity).IsAssignableFrom(t)
                )
            );
        }

        /// <summary>
        /// Remove a specific entity type and the types derived from that entity type.
        /// </summary>
        /// <typeparam name="TEntity">Type of the entity</typeparam>
        public static void Remove<TEntity>([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
            where TEntity : IEntity
        {
            Check.NotNull(selectors, nameof(selectors));

            var selectorName = "Entity:" + typeof(TEntity).FullName;
            selectors.RemoveAll(s => s.Name == selectorName);
        }

        /// <summary>
        /// Adds all entity types.
        /// </summary>
        public static void AddAll([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
        {
            Check.NotNull(selectors, nameof(selectors));

            if (selectors.Any(s => s.Name == AllEntitiesSelectorName))
            {
                return;
            }

            selectors.Add(
                new NamedTypeSelector(
                    AllEntitiesSelectorName,
                    t => typeof(IEntity).IsAssignableFrom(t)
                )
            );
        }

        public static void Add(
            [NotNull] this IAutoEntityDistributedEventSelectorList selectors,
            string selectorName,
            Func<Type, bool> 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}");
            }

            selectors.Add(
                new NamedTypeSelector(
                    selectorName,
                    predicate
                )
            );
        }

        public static void Add(
            [NotNull] this IAutoEntityDistributedEventSelectorList selectors,
            Func<Type, bool> predicate)
        {
            selectors.Add(Guid.NewGuid().ToString("N"), predicate);
        }


        public static void AddNamespace([NotNull] this IAutoEntityDistributedEventSelectorList selectors, [NotNull] string namespaceName)
        {
            Check.NotNull(selectors, nameof(selectors));

            var selectorName = "Namespace:" + namespaceName;
            if (selectors.Any(s => s.Name == selectorName))
            {
                return;
            }

            selectors.Add(
                new NamedTypeSelector(
                    selectorName,
                    t => t.FullName?.StartsWith(namespaceName) ?? false
                )
            );
        }
        
        /// <summary>
        /// Adds a specific entity type and the types derived from that entity type.
        /// </summary>
        /// <typeparam name="TEntity">Type of the entity</typeparam>
        public static void Add<TEntity>([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
            where TEntity : IEntity
        {
            Check.NotNull(selectors, nameof(selectors));

            var selectorName = "Entity:" + typeof(TEntity).FullName;
            if (selectors.Any(s => s.Name == selectorName))
            {
                return;
            }

            selectors.Add(
                new NamedTypeSelector(
                    selectorName,
                    t => typeof(TEntity).IsAssignableFrom(t)
                )
            );
        }
        
        /// <summary>
        /// Adds all entity types.
        /// </summary>
        public static void AddAll([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
        {
            Check.NotNull(selectors, nameof(selectors));
            
            if (selectors.Any(s => s.Name == AllEntitiesSelectorName))
            {
                return;
            }

            selectors.Add(
                new NamedTypeSelector(
                    AllEntitiesSelectorName,
                    t => typeof(IEntity).IsAssignableFrom(t)
                )
            );
        }

        public static void Add(
            [NotNull] this IAutoEntityDistributedEventSelectorList selectors,
            string selectorName, 
            Func<Type, bool> 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}");
            }

            selectors.Add(
                new NamedTypeSelector(
                    selectorName,
                    predicate
                )
            );
        }
        
        public static void Add(
            [NotNull] this IAutoEntityDistributedEventSelectorList selectors,
            Func<Type, bool> predicate)
        {
            selectors.Add(Guid.NewGuid().ToString("N"), predicate);
        }

        public static bool RemoveByName(
            [NotNull] this IAutoEntityDistributedEventSelectorList selectors,
            [NotNull] string name)
        {
            Check.NotNull(selectors, nameof(selectors));
            Check.NotNull(name, nameof(name));
            
            return selectors.RemoveAll(s => s.Name == name).Count > 0;
        }


    public static void AddNamespace([NotNull] this IAutoEntityDistributedEventSelectorList selectors, [NotNull] string namespaceName)
    {
        Check.NotNull(selectors, nameof(selectors));

        var selectorName = "Namespace:" + namespaceName;
        if (selectors.Any(s => s.Name == selectorName))
        {
            return;
        }

        selectors.Add(
            new NamedTypeSelector(
                selectorName,
                t => t.FullName?.StartsWith(namespaceName) ?? false
            )
        );
    }

    /// <summary>
    /// Adds a specific entity type and the types derived from that entity type.
    /// </summary>
    /// <typeparam name="TEntity">Type of the entity</typeparam>
    public static void Add<TEntity>([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
        where TEntity : IEntity
    {
        Check.NotNull(selectors, nameof(selectors));

        var selectorName = "Entity:" + typeof(TEntity).FullName;
        if (selectors.Any(s => s.Name == selectorName))
        {
            return;
        }

        selectors.Add(
            new NamedTypeSelector(
                selectorName,
                t => typeof(TEntity).IsAssignableFrom(t)
            )
        );
    }

    /// <summary>
    /// Remove a specific entity type and the types derived from that entity type.
    /// </summary>
    /// <typeparam name="TEntity">Type of the entity</typeparam>
    public static void Remove<TEntity>([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
        where TEntity : IEntity
    {
        Check.NotNull(selectors, nameof(selectors));

        var selectorName = "Entity:" + typeof(TEntity).FullName;
        //selectors.RemoveAll(s => s.Name == selectorName);
    }

    /// <summary>
    /// Adds all entity types.
    /// </summary>
    public static void AddAll([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
    {
        Check.NotNull(selectors, nameof(selectors));

        if (selectors.Any(s => s.Name == AllEntitiesSelectorName))
        {
            return;
        }

        selectors.Add(
            new NamedTypeSelector(
                AllEntitiesSelectorName,
                t => typeof(IEntity).IsAssignableFrom(t)
            )
        );
    }

    public static void Add(
        [NotNull] this IAutoEntityDistributedEventSelectorList selectors,
        string selectorName,
        Func<Type, bool> predicate)
    {
        Check.NotNull(selectors, nameof(selectors));

        if (selectors.Any(s => s.Name == selectorName))
        {
            throw new Exception($"There is already a selector added before with the same name: {selectorName}");
        }

        selectors.Add(
            new NamedTypeSelector(
                selectorName,
                predicate
            )
        );
    }

    public static void Add(
        [NotNull] this IAutoEntityDistributedEventSelectorList selectors,
        Func<Type, bool> predicate)
    {
        selectors.Add(Guid.NewGuid().ToString("N"), predicate);
    }


    public static void AddNamespace([NotNull] this IAutoEntityDistributedEventSelectorList selectors, [NotNull] string namespaceName)
    {
        Check.NotNull(selectors, nameof(selectors));

        var selectorName = "Namespace:" + namespaceName;
        if (selectors.Any(s => s.Name == selectorName))
        {
            return;
        }

        selectors.Add(
            new NamedTypeSelector(
                selectorName,
                t => t.FullName?.StartsWith(namespaceName) ?? false
            )
        );
    }

    /// <summary>
    /// Adds a specific entity type and the types derived from that entity type.
    /// </summary>
    /// <typeparam name="TEntity">Type of the entity</typeparam>
    public static void Add<TEntity>([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
        where TEntity : IEntity
    {
        Check.NotNull(selectors, nameof(selectors));

        var selectorName = "Entity:" + typeof(TEntity).FullName;
        if (selectors.Any(s => s.Name == selectorName))
        {
            return;
        }

        selectors.Add(
            new NamedTypeSelector(
                selectorName,
                t => typeof(TEntity).IsAssignableFrom(t)
            )
        );
    }

    /// <summary>
    /// Remove a specific entity type and the types derived from that entity type.
    /// </summary>
    /// <typeparam name="TEntity">Type of the entity</typeparam>
    public static void Remove<TEntity>([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
        where TEntity : IEntity
    {
        Check.NotNull(selectors, nameof(selectors));

        var selectorName = "Entity:" + typeof(TEntity).FullName;
        selectors.RemoveAll(s => s.Name == selectorName);
    }

    /// <summary>
    /// Adds all entity types.
    /// </summary>
    public static void AddAll([NotNull] this IAutoEntityDistributedEventSelectorList selectors)
    {
        Check.NotNull(selectors, nameof(selectors));

        if (selectors.Any(s => s.Name == AllEntitiesSelectorName))
        {
            return;
        }

        selectors.Add(
            new NamedTypeSelector(
                AllEntitiesSelectorName,
                t => typeof(IEntity).IsAssignableFrom(t)
            )
        );
    }

    public static void Add(
        [NotNull] this IAutoEntityDistributedEventSelectorList selectors,
        string selectorName,
        Func<Type, bool> 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}");
        }

        selectors.Add(
            new NamedTypeSelector(
                selectorName,
                predicate
            )
        );
    }

    public static void Add(
        [NotNull] this IAutoEntityDistributedEventSelectorList selectors,
        Func<Type, bool> predicate)
    {
        selectors.Add(Guid.NewGuid().ToString("N"), predicate);
    }

Volo.Abp.Domain.Entities.Events.Distributed.AutoEntityDistributedEventSelectorListExtensions : Object

Fields :

public static String AllEntitiesSelectorName

Methods :

public static Void AddNamespace(IAutoEntityDistributedEventSelectorList selectors = , String namespaceName = )
public static Void Add(IAutoEntityDistributedEventSelectorList selectors = )
public static Void Remove(IAutoEntityDistributedEventSelectorList selectors = )
public static Void AddAll(IAutoEntityDistributedEventSelectorList selectors = )
public static Void Add(IAutoEntityDistributedEventSelectorList selectors = , String selectorName = , Func<Type, Boolean> predicate = )
public static Void Add(IAutoEntityDistributedEventSelectorList selectors = , Func<Type, Boolean> predicate = )
public static Boolean RemoveByName(IAutoEntityDistributedEventSelectorList selectors = , String name = )
public static Boolean IsMatch(IAutoEntityDistributedEventSelectorList selectors = , Type entityType = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()