Skip to content

Commit 6c1612f

Browse files
authored
Update 1.md
1 parent 9ac6707 commit 6c1612f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ This will let me resolve `FooAndBar`, `IFoo` and `IBar` and it will give me the
136136

137137
## Creating instances of types from an IServiceProvider
138138

139-
Usually you need to register a type in order to instantiate instances of a type from the DI container, somebody needs to call `IServiceProvider.GetService`. This means that the service needs to be registered in the container. There's a useful utility called [ActivatorUtilities](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.activatorutilities?view=dotnet-plat-ext-5.0) that can be used as a factory for types that haven't been registered, but have dependencies that are registered in the DI container.
139+
Usually you need to register a type in order to instantiate instances of a type from the DI container, somebody needs to call `IServiceProvider.GetService`. This means that the service needs to be registered in the container. This may not be desirable if these types are discovered dynamically (like controllers in MVC). There's a useful utility called [ActivatorUtilities](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.activatorutilities?view=dotnet-plat-ext-5.0) that can be used as a factory for types that haven't been registered, but have dependencies that are registered in the DI container.
140140

141141
```C#
142142
public class MyDependency

0 commit comments

Comments
 (0)