Skip to content

Commit 559f928

Browse files
authored
Update README.md
1 parent cd8087d commit 559f928

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ IService service = c.GetService<IService>();
139139
When using with `TransientAttribute` the factory method would be invoked for every service resolution.
140140
When used with `SingletonAttribute` it would only be invoked the first time the service is requested.
141141

142+
Similar to constructors, factories support parameter injection:
143+
144+
```
145+
[ServiceProvider]
146+
[Transient(typeof(IService), Factory = nameof(MyServiceFactory))]
147+
[Transient(typeof(SomeOtherService))]
148+
internal partial class MyServiceProvider {
149+
public IService MyServiceFactory(SomeOtherService other) => new ServiceImplementation(other);
150+
}
151+
```
152+
142153
### Scoped Services
143154

144155
Scoped services are created once per service provider scope. To create a scope use the `CreateScope()` method of the service provider.

0 commit comments

Comments
 (0)