FacilityApi / FacilityAspNet

ASP.NET support for the Facility API Framework.
MIT License
1 stars 9 forks source link

Allow scoped HttpHandlers with UseFacilityHttpHandler. #6

Closed rmjohnson closed 4 years ago

rmjohnson commented 4 years ago

Without this change if I try to use a scoped dependency in my API implementation class, I get:

Cannot consume scoped service 'OrdersApi.v3.Submerchant.Client.ISubmerchantOrdersApiClient' from singleton 'Faithlife.SubmerchantsBff.v1.Client.ISubmerchantsBff'.

If I try to change my API to also be scoped, my handler needs to also be scoped, at which point I get

Cannot resolve scoped service from root provider

which led me to this StackOverflow article: https://stackoverflow.com/questions/48590579/cannot-resolve-scoped-service-from-root-provider-net-core-2

I would assume this change should be backwards compatible but I'm still pretty new to ASP.NET Core DI.

I verified this change fixes my problem by copying the DLL from my local FacilityAspNet to my API's bin folder.

rmjohnson commented 4 years ago

ping @ejball just in case you don't automatically get a notification for PRs.

ejball commented 4 years ago

Thanks! Merged and published as 2.1.1.