https://github.com/eventstorage/tdiscover
.Net type discovery and assembly scanning made simplified.
https://github.com/eventstorage/tdiscover
assembly dotnet extensions reflection types
Last synced: 4 months ago
JSON representation
.Net type discovery and assembly scanning made simplified.
- Host: GitHub
- URL: https://github.com/eventstorage/tdiscover
- Owner: eventstorage
- License: mit
- Created: 2024-09-11T23:27:37.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-10T00:50:34.000Z (over 1 year ago)
- Last Synced: 2025-10-16T21:19:36.620Z (8 months ago)
- Topics: assembly, dotnet, extensions, reflection, types
- Language: C#
- Homepage:
- Size: 34.2 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tdiscover
### A .Net library to help speed up and simplify type discovery.
[](https://github.com/eventstorage)
[](https://www.nuget.org/packages/TDiscover)
[](https://www.nuget.org/packages/TDiscover)
[](https://github.com/eventstorage/tdiscover)
### Overview
tdiscover simplifies type discovery overhead when searching through .Net assemblies with a bunch of helpful methods to speed up your development.
### Prerequisities
[](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
`tdiscover` runs on the stable release of .Net 8 and requires the SDK installed.
https://dotnet.microsoft.com/en-us/download/dotnet/8.0
### Install the package
Iinstall `TDiscover` package.
dotnet add package TDiscover
### Examples
Search for a derived type by its root.
```csharp
using System.Reflection;
using TDiscover;
public record AggregateRoot;
public record OrderAggregate : AggregateRoot;
var assembly = Assembly.GetExecutingAssembly();
var type = Td.FindByAsse(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.
```csharp
typeof(AggregateRoot).FindByCallingAsse(Assembly.GetCallingAssembly());
```
Search for a type through `AppDomain`, smart tricks and filters are applied to enhance the search.
```csharp
public record DomainEvent;
public record OrderPlaced : DomainEvent;
Td.FindByType();
```
To further enhance the above search, use `FindByTypeName` to specify the type and name as well.
```csharp
public record DomainEvent;
public record OrderPlaced : DomainEvent;
public record OrderConfirmed : DomainEvent;
Td.FindByTypeName("OrderPlaced");
// or typeof(DomainEvent).FindByTypeName("OrderPlaced");
```
Search for a type when all you have is the type name.
```csharp
Td.FindByTypeName("OrderPlaced");
```
### Give us a ⭐
If you are an assembly and typing guru, give [tdiscover](https://github.com/eventstorage/tdiscover) a star. :purple_heart:
### License
This project is licensed under the terms of [MIT](https://github.com/eventstorage/tdiscover/blob/main/LICENSE) license.