diff --git a/Telegrator/TypesExtensions.cs b/Telegrator/TypesExtensions.cs
index 8ee6452..d32c93f 100644
--- a/Telegrator/TypesExtensions.cs
+++ b/Telegrator/TypesExtensions.cs
@@ -297,10 +297,18 @@ namespace Telegrator
///
public static partial class HandlersCollectionExtensions
{
- private static readonly string[] skippingAssemblies = ["System.", "Microsoft."];
+ // TODO: rewrite collecting system, add certain hardcoded Type searching, generated automatically
+ private static readonly string[] skippingAssemblies = [
+ "System", "Microsoft", "Windows", "Newtonsoft", "Serilog", "NLog",
+ "AutoMapper", "MediatR", "Dapper", "RestSharp", "Polly", "FluentValidation",
+ "NUnit", "Xunit", "Moq", "FluentAssertions", "Castle", "Autofac", "Ninject",
+ "StackExchange", "RabbitMQ", "Quartz", "Hangfire", "Npgsql", "MySql", "Oracle",
+ "Bogus", "CsvHelper", "Grpc", "Swashbuckle", "MassTransit", "AngleSharp",
+ "Ocelot", "BouncyCastle", "IdentityModel", "Telegrator"
+ ]
///
- /// Collects all handlers from the current app domain.
+ /// Collects all public handlers from the current app domain.
/// Scans for types that implement handlers and adds them to the collection.
///
/// This collection instance for method chaining.
@@ -309,25 +317,21 @@ namespace Telegrator
{
AppDomain.CurrentDomain
.GetAssemblies()
- .Where(ass => ass.GetName().Name != "Telegrator")
.Where(ass => skippingAssemblies.All(skip => !ass.FullName.StartsWith(skip)))
- .SelectMany(ass => ass.GetExportedTypes())
- .Where(type => type.GetCustomAttribute() == null)
- .Where(type => type.IsHandlerRealization())
- .ForEach(type => handlers.AddHandler(type));
+ .ForEach(ass => ass.CollectHandlersAssemblyWide());
return handlers;
}
///
- /// Collects all handlers from the calling this function assembly.
+ /// Collects all public handlers from the calling this function assembly.
/// Scans for types that implement handlers and adds them to the collection.
///
/// This collection instance for method chaining.
/// Thrown when the entry assembly cannot be found.
- public static IHandlersCollection CollectHandlersAssemblyWide(this IHandlersCollection handlers)
+ public static IHandlersCollection CollectHandlersAssemblyWide(this IHandlersCollection handlers, Assembly collectingTarget = null)
{
- Assembly.GetCallingAssembly()
+ (collectingTarget ?? Assembly.GetCallingAssembly())
.GetExportedTypes()
.Where(type => type.GetCustomAttribute() == null)
.Where(type => type.IsHandlerRealization())