Skip to content

Commit be3c6af

Browse files
andrueastmanMIchaelMainer
authored andcommitted
Adds constructor to GraphServiceClient template (#221)
1 parent d6238c2 commit be3c6af

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Templates/CSharp/Requests/EntityClient.cs.tt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var clientName = entityContainer.Name.ToCheckedCase() + "Client";
88

99
namespace <#=entityContainer.Namespace.GetNamespaceName()#>
1010
{
11+
using System.Net.Http;
1112

1213
/// <summary>
1314
/// The type <#=clientName#>.
@@ -39,6 +40,17 @@ namespace <#=entityContainer.Namespace.GetNamespaceName()#>
3940
: base(baseUrl, authenticationProvider, httpProvider)
4041
{
4142
}
43+
44+
/// <summary>
45+
/// Instantiates a new <#=clientName#>.
46+
/// </summary>
47+
/// <param name="httpClient">The <see cref="HttpClient"/> to use for making requests to Microsoft Graph. Use the <see cref="GraphClientFactory"/>
48+
/// to get a pre-configured HttpClient that is optimized for use with the Microsoft Graph service API. </param>
49+
public <#=clientName#>(
50+
HttpClient httpClient)
51+
: base("<#=ConfigurationService.Settings.DefaultBaseEndpointUrl#>", httpClient)
52+
{
53+
}
4254
<#
4355

4456
foreach(var prop in model.EntityContainer.Properties)

0 commit comments

Comments
 (0)