You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Question] Best practices ServiceClient & Dependency Injection #311
Do you have any guidance / best practices when using the ServiceClient in web applications or function apps? These will use dependency injection. Kind of similar to what was done for the HttpClient.
So basically: What is the correct way of using the ServiceClient with Dependency Injection in web applications?
Yep. this is on the "To-Do" list for samples for the client,
also, we are internally testing a few different extensions for Dependency injection, one of which we may add to the client in the future.
Good to know, thanks for the information. With the current constraints, what is the best approach? I know I can make it 'work' by implementing something like in the link. However I'm not sure what the consequences are for using in example Scoped or Singleton.
Scoped or Singleton uses cases are situational, IE, what are you trying to accomplish in the function or asp.net core app.
We do not have a strong opinion on it and are using both processes in different services.
Mainly what we are testing is memory and isolation management options for us in API services (function and the like), when running at scale over a long period of time. Once we settle on a specific approach, we will build it into the client as an extension. In the meantime, we may provide a sample or 2 on the PowerApps Samples site based on current work.
Activity
jordimontana82 commentedon Sep 5, 2022
Martijn Vermaat (@mVermaat) I think that is not coevered in the Dataverse docs (yet) but here's a nice example by Temmy Temmy Wahyu Raharjo (@temmyraharjo):
https://temmyraharjo.wordpress.com/2022/07/09/how-to-make-azure-functions-dataverse-service-client/
MattB-msft commentedon Sep 5, 2022
Yep. this is on the "To-Do" list for samples for the client,
also, we are internally testing a few different extensions for Dependency injection, one of which we may add to the client in the future.
mVermaat commentedon Sep 6, 2022
Good to know, thanks for the information. With the current constraints, what is the best approach? I know I can make it 'work' by implementing something like in the link. However I'm not sure what the consequences are for using in example Scoped or Singleton.
MattB-msft commentedon Sep 6, 2022
Scoped or Singleton uses cases are situational, IE, what are you trying to accomplish in the function or asp.net core app.
We do not have a strong opinion on it and are using both processes in different services.
Mainly what we are testing is memory and isolation management options for us in API services (function and the like), when running at scale over a long period of time. Once we settle on a specific approach, we will build it into the client as an extension. In the meantime, we may provide a sample or 2 on the PowerApps Samples site based on current work.