tdiscover simplifies type discovery overhead when searching through .Net assemblies with a bunch of helpful methods to speed up your development.
tdiscover runs on the stable release of .Net 8 and requires the SDK installed.
https://dotnet.microsoft.com/en-us/download/dotnet/8.0
Iinstall TDiscover package.
dotnet add package TDiscover
Search for a derived type by its root.
using System.Reflection;
using TDiscover;
public record AggregateRoot;
public record OrderAggregate : AggregateRoot;
var assembly = Assembly.GetExecutingAssembly();
var type = Td.FindByAsse<AggregateRoot>(assembly);
// or typeof(AggregateRoot).FindByAsse(assembly);Use FindByCallingAsse() to start from calling assembly all the way back to matching assembly, FindByCallingAsse() offers significant performance gains.
typeof(AggregateRoot).FindByCallingAsse(Assembly.GetCallingAssembly());Search for a type through AppDomain, smart tricks and filters are applied to enhance the search.
public record DomainEvent;
public record OrderPlaced : DomainEvent;
Td.FindByType<DomainEvent>();To further enhance the above search, use FindByTypeName to specify the type and name as well.
public record DomainEvent;
public record OrderPlaced : DomainEvent;
public record OrderConfirmed : DomainEvent;
Td.FindByTypeName<DomainEvent>("OrderPlaced");
// or typeof(DomainEvent).FindByTypeName("OrderPlaced");Search for a type when all you have is the type name.
Td.FindByTypeName("OrderPlaced");If you are an assembly and typing guru, give tdiscover a star. 💜
This project is licensed under the terms of MIT license.
