Skip to content

Commit 22bc0c2

Browse files
committed
Updated excluded classes
1 parent 96f83a2 commit 22bc0c2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

READMe.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# NetCore.AutoRegisterDi
22

3-
This [NuGet library](https://www.nuget.org/packages/NetCore.AutoRegisterDi/) contains an extension method to scan an assemby and register all the public classes against their implemented interfaces(s) into the Microsoft.Extensions.DependencyInjection dependency injection provider.
3+
This [NuGet library](https://www.nuget.org/packages/NetCore.AutoRegisterDi/) contains an extension method to scan an assemby and register all the non-generic public classes (see [excluded type](https://github.com/JonPSmith/NetCore.AutoRegisterDi#1-the-registerassemblypublicnongenericclasses-method) against their implemented interfaces(s) into the Microsoft.Extensions.DependencyInjection dependency injection provider.
44

55
I have written a simple version of AutoFac's `RegisterAssemblyTypes` method that works directly with Microsoft's DI provider. Here are an example of me using this with ASP.NET Core.
66

@@ -58,11 +58,13 @@ I therefore implemented a similar (but not exactly the same) feature for the
5858
Microsoft.Extensions.DependencyInjection library.
5959

6060

61-
6261
### Detailed information
6362

6463
There are four parts:
65-
1. `RegisterAssemblyPublicNonGenericClasses`, which finds all the classes.
64+
1. `RegisterAssemblyPublicNonGenericClasses`, which finds all the public classes that :
65+
- Aren't abstract
66+
- Aren't a generic type, e.g. MyClass\<AnotherClass\>
67+
- Isn't nested. e.g. It won't look at classes defined inside other classes
6668
2. An options `Where` method, which allows you to filter the classes to be considered.
6769
3. The `AsPublicImplementedInterfaces` method which finds ant interfaces on a class and registers those interfaces as pointing to the class.
6870
4. Various attributes that you can add to your classes to tell `NetCore.AutoRegisterDi` what to do:

0 commit comments

Comments
 (0)