orleans icon indicating copy to clipboard operation
orleans copied to clipboard

DI Into Storage Providers

Open edikep2000 opened this issue 10 years ago • 3 comments

Hello Everyone,

I am just curious to know if Custom Storage Providers (Classes Implementing IStorage Providers), currently Participate in Dependency Injection (Can have services Injected Into Them) .

edikep2000 avatar Nov 04 '16 09:11 edikep2000

I think currently it's a service locator pattern. You can access to the service locator through IProviderRuntime.ServiceProvider in IProvider's Init method, though it is not technically a DI pattern. But there's a way to access to the services registered in the service locator

xiazen avatar Nov 04 '16 20:11 xiazen

But we are trying to make DI in Orleans better, supporting DI in Providers is one of the tasks we are constantly talking about and making plans to make it better

xiazen avatar Nov 04 '16 20:11 xiazen

The short answer is no. They do have access to the ServiceProvider to retrieve services, but currently provider instances are not created or registered with DI, so we don't support ctor injection yet.

As @xiazen wrote it will change in the future as we're moving more classes towards DI support.

attilah avatar Nov 04 '16 21:11 attilah