File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,17 @@ IService service = c.GetService<IService>();
139
139
When using with ` TransientAttribute ` the factory method would be invoked for every service resolution.
140
140
When used with ` SingletonAttribute ` it would only be invoked the first time the service is requested.
141
141
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
+
142
153
### Scoped Services
143
154
144
155
Scoped services are created once per service provider scope. To create a scope use the ` CreateScope() ` method of the service provider.
You can’t perform that action at this time.
0 commit comments