orleans icon indicating copy to clipboard operation
orleans copied to clipboard

Suggest RequestContext add an IServiceProvider property, so easy to control

Open lfzm opened this issue 8 years ago • 7 comments

Suggest RequestContext add an IServiceProvider property, so easy to control

lfzm avatar Feb 05 '18 03:02 lfzm

Suggest RequestContext and AspNet HttpContext can make an object, and then access (HttpContextAccessor) accessor.

lfzm avatar Feb 05 '18 03:02 lfzm

I don't understand the HttpContext part. Can't serialize and pass it to another machine (silo host), can we?

sergeybykov avatar Feb 06 '18 17:02 sergeybykov

Can I know what's the use case of adding IServiceProvider to RequestContext? What do you intend to do with it?

xiazen avatar Feb 06 '18 18:02 xiazen

@sergeybykov @xiazen I recently custom an authorization module passed through the RequestContext JWT Token in the authorization module need to pass IServiceProvider into it, if RequestContext IServiceProvider then there is no need to pass

lfzm avatar Feb 07 '18 01:02 lfzm

@aqa510415008 any place where you might need IServiceProvider, you can inject it - unless there's something which we are not yet constructing using dependency injection. Where in your code do you need the IServiceProvider?

Could you paste some code to demonstrate?

I have successfully used JWT tokens in the RequestContext in past projects without IServiceProvider

ReubenBond avatar Feb 07 '18 02:02 ReubenBond

@ReubenBond I just use this method to solve, RequestContext IServiceProvider more friendly.

lfzm avatar Feb 07 '18 02:02 lfzm

RequestContext is for transferring metadata along with a request only (providing context to a request), not for acting as a Service Locator

ReubenBond avatar Feb 07 '18 02:02 ReubenBond