Skip to content

Commit 89c5117

Browse files
committed
Minor updates to comments
1 parent 54f319d commit 89c5117

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

READMe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
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 class types](https://github.com/JonPSmith/NetCore.AutoRegisterDi#1-the-registerassemblypublicnongenericclasses-method)) against their implemented interfaces(s) into the `Microsoft.Extensions.DependencyInjection` dependency injection provider.
44

5-
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.
6-
75
**Version 2.0.0 update**: New attributes for defining the `ServiceLifetime` of your classes, e.g. adding the `[RegisterAsScoped]` attribute to a class will mean its `ServiceLifetime` in the DI will be set to `Scoped`. *Added by Fedor Zhekov (GitHub @ZFi88)*.
86

97
**Version 2.1.0 update**: Added ability ignore an interface, plus added `ISerializable` interface to list of ignored interfaces and outputs results so that you can check it is registering the correct things.
108

9+
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.
10+
1111
## Example 1 - scan the calling assembly
1212

1313
```c#

Test/TestAutoRegisterResult.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public void TestAsPublicImplementedInterfacesMyService()
2727
var service = new ServiceCollection();
2828

2929
//ATTEMPT
30-
var results = service.RegisterAssemblyPublicNonGenericClasses()
30+
var results = service
31+
.RegisterAssemblyPublicNonGenericClasses()
3132
.AsPublicImplementedInterfaces();
3233

3334
//VERIFY
@@ -55,7 +56,8 @@ public void TestAsPublicImplementedInterfacesWithIgnore()
5556
var service = new ServiceCollection();
5657

5758
//ATTEMPT
58-
var results = service.RegisterAssemblyPublicNonGenericClasses()
59+
var results = service
60+
.RegisterAssemblyPublicNonGenericClasses()
5961
.IgnoreThisInterface<IAnotherInterface>()
6062
.AsPublicImplementedInterfaces();
6163

0 commit comments

Comments
 (0)