Skip to content

Commit 97ae97f

Browse files
authored
Merge pull request #4 from eventstorage/develop
update namespaces and readmes
2 parents 1e153a6 + 5c32fa7 commit 97ae97f

7 files changed

+70
-74
lines changed

.assets/ah_radius.PNG

-3.03 KB
Binary file not shown.

.assets/github.png

4.54 KB
Loading

Directory.Build.props

+6-8
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,21 @@
44
<TargetFramework>net8.0</TargetFramework>
55
<!-- <LangVersion>13</LangVersion> -->
66
<!-- <GeneratePackageOnBuild>true</GeneratePackageOnBuild> -->
7-
<Version>1.1.0</Version>
8-
<Authors>asynchandler</Authors>
9-
<Company>asynchandler</Company>
7+
<Version>0.0.0-alpha</Version>
8+
<Authors>eventstorage</Authors>
9+
<Company>eventstorage</Company>
1010
<PackageTags>Assembly;Type;Reflection;Extensions;AppDomain;EventSourcing</PackageTags>
1111
<Description>
12-
A library to help simplify type and assembly discovery.
12+
.Net type discovery and assembly scanning made simplified.
1313
</Description>
14-
<PackageProjectUrl>https://github.com/asynchandler/AsyncHandler.Assembly</PackageProjectUrl>
15-
<PackageIcon>ah_radius.png</PackageIcon>
14+
<PackageProjectUrl>https://github.com/eventstorage/tdiscover</PackageProjectUrl>
1615
<PackageReadmeFile>README.md</PackageReadmeFile>
17-
<RepositoryUrl>https://github.com/asynchandler/AsyncHandler.Assembly</RepositoryUrl>
16+
<RepositoryUrl>https://github.com/eventstorage/tdiscover.git</RepositoryUrl>
1817
<RepositoryType>git</RepositoryType>
1918
<PackageLicenseFile>LICENSE</PackageLicenseFile>
2019
</PropertyGroup>
2120

2221
<ItemGroup>
23-
<None Include="..\.assets\ah_radius.png" Pack="true" PackagePath="\"/>
2422
<None Include="README.md" Pack="true" PackagePath="\"/>
2523
<None Include="..\LICENSE" Pack="true" PackagePath="\"/>
2624
</ItemGroup>

README.md

+18-19
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
1-
# AsyncHandler.Assembly
2-
### A .Net library that helps making type discovery faster and simplified.
1+
# tdiscover
2+
### A .Net library to help speed up and simplify type discovery.
33

4-
[![Github follow](https://img.shields.io/badge/follow-asynchandler-bf9136?logo=github)](https://github.com/asynchandler)
5-
[![Github follow](https://img.shields.io/badge/follow-eventsourcer-bf9136?logo=github)](https://github.com/eventsourcer)
6-
[![Nuget Package](https://badgen.net/nuget/v/asynchandler.Assembly)](https://www.nuget.org/packages/AsyncHandler.Assembly)
7-
[![Nuget](https://badgen.net/nuget/dt/asynchandler.Assembly)](https://www.nuget.org/packages/AsyncHandler.Assembly)
8-
[![Github follow](https://img.shields.io/badge/give_us_a-⭐-yellow?logo=github)](https://github.com/asynchandler/AsyncHandler.Assembly)
4+
[![Github follow](https://img.shields.io/badge/follow-eventstorage-bf9136?logo=github)](https://github.com/eventstorage)
5+
[![Nuget Package](https://badgen.net/nuget/v/TDiscover)](https://www.nuget.org/packages/TDiscover)
6+
[![Nuget](https://badgen.net/nuget/dt/TDiscover)](https://www.nuget.org/packages/TDiscover)
7+
[![Github follow](https://img.shields.io/badge/give_us_a-⭐-yellow?logo=github)](https://github.com/eventstorage/tdiscover)
98

109
<div align="left">
11-
<img src=".assets/github.png" width="80" height="80" style="float:left;" alt="asynchandler">
10+
<img src=".assets/github.PNG" width="80" height="80" style="float:left;" alt="asynchandler">
1211
</div>
1312

1413
### Overview
15-
`AsyncHandler.Assembly` simplifies type discovery overhead when searching through .Net assemblies with a bunch of helpful methods to speed up your development.
14+
tdiscover simplifies type discovery overhead when searching through .Net assemblies with a bunch of helpful methods to speed up your development.
1615

1716
### Prerequisities
1817
[![My Skills](https://skillicons.dev/icons?i=dotnet)](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
1918

20-
The library runs on the stable release of .Net 8 and requires the SDK installed:
19+
`tdiscover` runs on the stable release of .Net 8 and requires the SDK installed.
2120

2221
https://dotnet.microsoft.com/en-us/download/dotnet/8.0
2322

2423
### Install the package
2524

26-
Iinstall `AsyncHandler.Assembly` package.
25+
Iinstall `TDiscover` package.
2726

28-
dotnet add package AsyncHandler.Assembly
27+
dotnet add package TDiscover
2928

3029
### Examples
3130
Search for a derived type by its root.
3231
```csharp
3332
using System.Reflection;
34-
using AsyncHandler.Assembly;
33+
using TDiscover;
3534

3635
public record AggregateRoot;
3736
public record OrderAggregate : AggregateRoot;
3837

3938
var assembly = Assembly.GetExecutingAssembly();
40-
var type = TDiscover.FindByAsse<AggregateRoot>(assembly);
39+
var type = Td.FindByAsse<AggregateRoot>(assembly);
4140
// or typeof(AggregateRoot).FindByAsse(assembly);
4241
```
4342

@@ -51,7 +50,7 @@ Search for a type through `AppDomain`, smart tricks and filters are applied to e
5150
public record DomainEvent;
5251
public record OrderPlaced : DomainEvent;
5352

54-
TDiscover.FindByType<DomainEvent>();
53+
Td.FindByType<DomainEvent>();
5554
```
5655

5756
To further enhance the above search, use `FindByTypeName` to specify the type and name as well.
@@ -60,18 +59,18 @@ public record DomainEvent;
6059
public record OrderPlaced : DomainEvent;
6160
public record OrderConfirmed : DomainEvent;
6261

63-
TDiscover.FindByTypeName<DomainEvent>("OrderPlaced");
62+
Td.FindByTypeName<DomainEvent>("OrderPlaced");
6463
// or typeof(DomainEvent).FindByTypeName("OrderPlaced");
6564
```
6665
Search for a type when all you have is the type name.
6766

6867
```csharp
69-
TDiscover.FindByTypeName("OrderPlaced");
68+
Td.FindByTypeName("OrderPlaced");
7069
```
7170

7271
### Give us a ⭐
73-
If you are an assembly and typing guru, give [AsyncHandler.Assembly](https://github.com/asynchandler/AsyncHandler.Assembly) a star. :purple_heart:
72+
If you are an assembly and typing guru, give [tdiscover](https://github.com/eventstorage/tdiscover) a star. :purple_heart:
7473

7574
### License
7675

77-
This project is licensed under the terms of the [MIT](https://github.com/asynchandler/AsyncHandler.Assembly/blob/main/LICENSE) license.
76+
This project is licensed under the terms of [MIT](https://github.com/eventstorage/tdiscover/blob/main/LICENSE) license.

src/README.md

+17-19
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
1-
# AsyncHandler.Assembly
2-
### .Net type discovery and assembly scanning made simplified.
1+
# tdiscover
2+
### A .Net library to help speed up and simplify type discovery.
33

4-
[![Github follow](https://img.shields.io/badge/follow-asynchandler-bf9136?logo=github)](https://github.com/asynchandler)
5-
[![Github follow](https://img.shields.io/badge/follow-eventsourcer-bf9136?logo=github)](https://github.com/eventsourcer)
6-
[![Nuget Package](https://badgen.net/nuget/v/asynchandler.Assembly)](https://www.nuget.org/packages/AsyncHandler.Assembly)
7-
[![Nuget](https://badgen.net/nuget/dt/asynchandler.Assembly)](https://www.nuget.org/packages/AsyncHandler.Assembly)
8-
[![Github follow](https://img.shields.io/badge/give_us_a-⭐-yellow?logo=github)](https://github.com/asynchandler/AsyncHandler.Assembly)
4+
[![Github follow](https://img.shields.io/badge/follow-eventstorage-bf9136?logo=github)](https://github.com/eventstorage)
5+
[![Nuget Package](https://badgen.net/nuget/v/TDiscover)](https://www.nuget.org/packages/TDiscover)
6+
[![Nuget](https://badgen.net/nuget/dt/TDiscover)](https://www.nuget.org/packages/TDiscover)
7+
[![Github follow](https://img.shields.io/badge/give_us_a-⭐-yellow?logo=github)](https://github.com/eventstorage/tdiscover)
98

109

1110
### Overview
12-
`AsyncHandler.Assembly` helps simplifying type discovery overhead when searching through .Net assemblies with a bunch of helpful methods to speed up your development.
11+
tdiscover simplifies type discovery overhead when searching through .Net assemblies with a bunch of helpful methods to speed up your development.
1312

1413
### Prerequisities
15-
[![My Skills](https://skillicons.dev/icons?i=dotnet)](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
1614

17-
The library runs on the stable release of .Net 8 and requires the SDK installed:
15+
`tdiscover` runs on the stable release of .Net 8 and requires the SDK installed.
1816

1917
https://dotnet.microsoft.com/en-us/download/dotnet/8.0
2018

2119
### Install the package
2220

23-
Iinstall `AsyncHandler.Assembly` package.
21+
Iinstall `TDiscover` package.
2422

25-
dotnet add package AsyncHandler.Assembly
23+
dotnet add package TDiscover
2624

2725
### Examples
2826
Search for a derived type by its root.
2927
```csharp
3028
using System.Reflection;
31-
using AsyncHandler.Assembly;
29+
using TDiscover;
3230

3331
public record AggregateRoot;
3432
public record OrderAggregate : AggregateRoot;
3533

3634
var assembly = Assembly.GetExecutingAssembly();
37-
var type = TDiscover.FindByAsse<AggregateRoot>(assembly);
35+
var type = Td.FindByAsse<AggregateRoot>(assembly);
3836
// or typeof(AggregateRoot).FindByAsse(assembly);
3937
```
4038

@@ -48,7 +46,7 @@ Search for a type through `AppDomain`, smart tricks and filters are applied to e
4846
public record DomainEvent;
4947
public record OrderPlaced : DomainEvent;
5048

51-
TDiscover.FindByType<DomainEvent>();
49+
Td.FindByType<DomainEvent>();
5250
```
5351

5452
To further enhance the above search, use `FindByTypeName` to specify the type and name as well.
@@ -57,18 +55,18 @@ public record DomainEvent;
5755
public record OrderPlaced : DomainEvent;
5856
public record OrderConfirmed : DomainEvent;
5957

60-
TDiscover.FindByTypeName<DomainEvent>("OrderPlaced");
58+
Td.FindByTypeName<DomainEvent>("OrderPlaced");
6159
// or typeof(DomainEvent).FindByTypeName("OrderPlaced");
6260
```
6361
Search for a type when all you have is the type name.
6462

6563
```csharp
66-
TDiscover.FindByTypeName("OrderPlaced");
64+
Td.FindByTypeName("OrderPlaced");
6765
```
6866

6967
### Give us a ⭐
70-
If you are an event sourcer and love OSS, give [AsyncHandler.Assembly](https://github.com/asynchandler/AsyncHandler.Assembly) a star. :purple_heart:
68+
If you are an assembly and typing guru, give [tdiscover](https://github.com/eventstorage/tdiscover) a star. :purple_heart:
7169

7270
### License
7371

74-
This project is licensed under the terms of the [MIT](https://github.com/asynchandler/AsyncHandler.Assembly/blob/main/LICENSE) license.
72+
This project is licensed under the terms of [MIT](https://github.com/eventstorage/tdiscover/blob/main/LICENSE) license.

src/TDiscover.cs src/Td.cs

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
namespace AsyncHandler.Asse;
1+
namespace TDiscover;
22

33
using System.Reflection;
44
/// <summary>
55
/// Helper methods to find your type
66
/// </summary>
7-
public static class TDiscover
7+
public static class Td
88
{
99
/// <summary>
1010
/// Exclude assemblies to enhance performance
@@ -20,7 +20,7 @@ public static class TDiscover
2020
{
2121
return assembly.GetTypes().Where(x => typeof(T).IsAssignableFrom(x)).FirstOrDefault();
2222
}
23-
23+
2424
/// <summary>
2525
/// Searches through the provided calling assembly, this reverse search starting from
2626
/// caller results in significant performance gains compared to AppDomain.
@@ -32,9 +32,9 @@ public static class TDiscover
3232
{
3333
var type = caller.GetTypes()
3434
.FirstOrDefault(x => typeof(T).IsAssignableFrom(x));
35-
if(type != null)
35+
if (type != null)
3636
return type;
37-
37+
3838
var refs = caller.GetReferencedAssemblies()
3939
.Where(r => !ExcludedAssemblies.Any(x => r.FullName.StartsWith(x)));
4040

@@ -53,10 +53,10 @@ public static class TDiscover
5353
public static Type? FindByType<T>()
5454
{
5555
var asses = (from assembly in AppDomain.CurrentDomain.GetAssemblies()
56-
where assembly.FullName != null &&
57-
!ExcludedAssemblies.Any(x => assembly.FullName.StartsWith(x)) &&
58-
assembly.ManifestModule.Name != "<In Memory Module>"
59-
select assembly
56+
where assembly.FullName != null &&
57+
!ExcludedAssemblies.Any(x => assembly.FullName.StartsWith(x)) &&
58+
assembly.ManifestModule.Name != "<In Memory Module>"
59+
select assembly
6060
).ToList();
6161

6262
var targetDefinition = typeof(T).Assembly.GetName();
@@ -77,10 +77,10 @@ select assembly
7777
public static Type? FindByTypeName<T>(string typeName)
7878
{
7979
var asses = (from assembly in AppDomain.CurrentDomain.GetAssemblies()
80-
where assembly.FullName != null &&
81-
!ExcludedAssemblies.Any(x => assembly.FullName.StartsWith(x)) &&
82-
assembly.ManifestModule.Name != "<In Memory Module>"
83-
select assembly
80+
where assembly.FullName != null &&
81+
!ExcludedAssemblies.Any(x => assembly.FullName.StartsWith(x)) &&
82+
assembly.ManifestModule.Name != "<In Memory Module>"
83+
select assembly
8484
).ToList();
8585

8686
var targetDefinition = typeof(T).Assembly.GetName();
@@ -90,7 +90,7 @@ select assembly
9090
.SelectMany(a => a.GetTypes())
9191
.FirstOrDefault(t => typeof(T).IsAssignableFrom(t) && t.Name == typeName);
9292
}
93-
93+
9494
/// <summary>
9595
/// Searches through the AppDomain for the type argument specified.
9696
/// use this when you want you search for a type name.
@@ -100,10 +100,10 @@ select assembly
100100
public static Type? FindByTypeName(string typeName)
101101
{
102102
var asses = (from assembly in AppDomain.CurrentDomain.GetAssemblies()
103-
where assembly.FullName != null &&
104-
!ExcludedAssemblies.Any(x => assembly.FullName.StartsWith(x)) &&
105-
assembly.ManifestModule.Name != "<In Memory Module>"
106-
select assembly
103+
where assembly.FullName != null &&
104+
!ExcludedAssemblies.Any(x => assembly.FullName.StartsWith(x)) &&
105+
assembly.ManifestModule.Name != "<In Memory Module>"
106+
select assembly
107107
).ToList();
108108

109109
return asses.SelectMany(a => a.GetTypes())

src/TypeExtensions.cs

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
namespace AsyncHandler.Asse;
1+
namespace TDiscover;
22

33
using System.Reflection;
4+
45
/// <summary>
56
/// Helper methods to find your type
67
/// </summary>
78
public static class TypeExtensions
89
{
9-
10+
1011
/// <summary>
1112
/// Searches through the provided assembly.
1213
/// </summary>
@@ -17,7 +18,7 @@ public static class TypeExtensions
1718
{
1819
return assembly.GetTypes().Where(x => type.IsAssignableFrom(x)).FirstOrDefault();
1920
}
20-
21+
2122
/// <summary>
2223
/// Searches through the provided calling assembly, this reverse search starting from
2324
/// caller results in significant performance gains compared to AppDomain.
@@ -29,11 +30,11 @@ public static class TypeExtensions
2930
{
3031
var exists = caller.GetTypes()
3132
.FirstOrDefault(x => type.IsAssignableFrom(x));
32-
if(exists != null)
33+
if (exists != null)
3334
return exists;
34-
35+
3536
var refs = caller.GetReferencedAssemblies()
36-
.Where(r => !TDiscover.ExcludedAssemblies.Any(x => r.FullName.StartsWith(x)));
37+
.Where(r => !Td.ExcludedAssemblies.Any(x => r.FullName.StartsWith(x)));
3738

3839
return refs.Where(x => Assembly.Load(x).GetReferencedAssemblies()
3940
.Any(r => AssemblyName.ReferenceMatchesDefinition(r, type.Assembly.GetName())))
@@ -51,10 +52,10 @@ public static class TypeExtensions
5152
public static Type? FindByTypeName(this Type type, string typeName)
5253
{
5354
var asses = (from assembly in AppDomain.CurrentDomain.GetAssemblies()
54-
where assembly.FullName != null &&
55-
!TDiscover.ExcludedAssemblies.Any(x => assembly.FullName.StartsWith(x)) &&
56-
assembly.ManifestModule.Name != "<In Memory Module>"
57-
select assembly
55+
where assembly.FullName != null &&
56+
!Td.ExcludedAssemblies.Any(x => assembly.FullName.StartsWith(x)) &&
57+
assembly.ManifestModule.Name != "<In Memory Module>"
58+
select assembly
5859
).ToList();
5960

6061
var targetDefinition = type.Assembly.GetName();

0 commit comments

Comments
 (0)