Azure / azure-functions-signalrservice-extension

Azure Functions bindings for SignalR Service. Project moved to https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/signalr/Microsoft.Azure.WebJobs.Extensions.SignalRService .
MIT License
97 stars 46 forks source link

Hub Context Attribute #263

Closed phantomcosmonaut closed 2 years ago

phantomcosmonaut commented 2 years ago

allows developers to set a custom connection string setting name that will be passed to the hub context property. The attribute is picked up by trigger bindings automatically

ghost commented 2 years ago

CLA assistant check
All CLA requirements met.

Y-Sindo commented 2 years ago

How about letting the ServerlessHub virtually implements IConnectionProvider ?

phantomcosmonaut commented 2 years ago

How about letting the ServerlessHub virtually implements IConnectionProvider ?

OK, I did this but not virtually. Not sure how to resolve connection string within SignalRTriggerAttribute now, but I am fine with explicitly setting it.

Y-Sindo commented 2 years ago

Sorry, I found we can't get the Connection field of ServerlessHub from SignalRTriggerBindingProvider, so we have to switch back to attribute style.

I created a branch and here is the sample : https://github.com/Azure/azure-functions-signalrservice-extension/compare/dev...Y-Sindo:pr/phantomcosmonaut/263?expand=1 I've put the attribute nested into ServerlessHub so that users can't use it outside of ServerlessHub. Also changed its name.

phantomcosmonaut commented 2 years ago

Cool, thanks for looking into it. Should the attribute just be protected and not protected internal?

Y-Sindo commented 2 years ago

Cool, thanks for looking into it. Should the attribute just be protected and not protected internal?

It should be used in SignalRTriggerBindingProvider at https://github.com/Azure/azure-functions-signalrservice-extension/pull/263/files/077f73bbfb51e6b42f967170b8a1cabe713b16c3

phantomcosmonaut commented 2 years ago

Cool, thanks for looking into it. Should the attribute just be protected and not protected internal?

It should be used in SignalRTriggerBindingProvider at https://github.com/Azure/azure-functions-signalrservice-extension/pull/263/files/077f73bbfb51e6b42f967170b8a1cabe713b16c3

Right, I was still using the old attribute. I have updated this