Skip to content

Commit 69b1ed5

Browse files
committed
Resync from Main Branch for 1.0 release.
1 parent 692e17f commit 69b1ed5

26 files changed

Lines changed: 589 additions & 112 deletions

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# CoreXT generated files
1+
# CoreXT generated files
2+
23
.corext/gen/
34
build/environment/
45

56
# Cake
67
/.cake
78
/version.txt
89
/PSRunCmds*.ps1
9-
1010
# Build output
11+
1112
/bin/
1213
/binSigned/
1314
/obj/
@@ -51,6 +52,7 @@ TestResults
5152

5253
#Skip Nuget Packages
5354
/src/**/packages/*
55+
/src/**/.packages/*
5456

5557
# Build generated files in src
5658
/src/**/objd/**/*
@@ -88,6 +90,4 @@ src/Localize/Temp
8890
/src/GeneralTools/XrmSDK/TestXrmSDKConnection
8991
/src/GeneralTools/XrmSDK/StandardConsoleApp
9092
/src/GeneralTools/XrmSDK/CdsSdkShim
91-
92-
# Skip generated nuget.config
93-
/nuget.config
93+
/build/cake/test/*

README.md

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ This repository contains the code for the Microsoft.PowerPlatform.Dataverse.Clie
1616

1717
**IMPORTANT NOTES**
1818

19-
**The Dataverse ServiceClient is in Preview**
20-
2119
**The Dataverse ServiceClient cannot be built outside of Microsoft**
2220
This is due to a set of dependencies on nuget packages that are internally available only. At some point in the future, we will expose the supporting nuget packages when we have updated our server infrastructure to support plugin development on .net core.
2321

@@ -32,41 +30,30 @@ This nuget package has been deprecated (for now) ~~[Microsoft.Dynamics.Sdk.Messa
3230

3331
This library is and its supporting assemblies are a revision and update of the Microsoft.Xrm.Tooling.Connector.CrmServiceClient and the underlying Microsoft.Xrm.Sdk.Client libraries.
3432

35-
We are using this effort to for a few key things we have wanted to get done for a number of years,
36-
37-
1. Refactor and update our client libraries to allow us to spit up PowerPlatform Common Data Service SDK support from Microsoft Dynamics 365.
38-
2. Provide multi targeted library build that targets our supported .net client platforms.
39-
3. Update connection patterns and behaviors to be consistent with many of the broadly accepted patterns.
40-
4. Create a pattern to allow developers focus on the use of Dataverse, or Dataverse + Dynamics as they need.
41-
4233
We encourage you to read the release notes we provide with each nuget packages. As with most of our Nuget packages that are intended as tools or for developer consumption, we extensively comment in release notes.
4334

44-
At this time: (03/06/2022)
35+
At this time: (06/13/2022)
4536
The Client SDK libs supports the following and has the following notices:
4637

47-
* 0.6.x is **expected** to be the final preview release, followed by 1.0
48-
* 0.6.x refactors much of the primary ServiceClient interface, narrowing its focus to primary operations against Dataverse. the ballance of the feature set has been moved to Microsoft.PowerPlatform.Dataverse.Client.Extensions. - We are seeking feedback on this refactor.
38+
* VS 2022 + .net 6 is required to build this project currently. see: [global.json](global.json) for current requirements.
4939
* .net full framework 4.6.2, 4.7.2, 4.8 and .net core 3.0, 3.1, 5.0, 6.0
5040
* We now support all authentication types from CrmServiceClient for .net framework, ( Client\Secret, Client\Cert, UID\PW Noninteractive, UID\PW interactive.)
5141
* We support the following authentication types from CrmServiceClient for .net core: Client\Secret, Client\Cert, UID\PW interactive.
52-
* MSAL Port has been completed, this Lib is now using MSAL 4.35+
5342
* Plugin Development using this Client is NOT supported at this time.
5443

5544
From a scenario point of view, we are particularity interested in any issues or challenges when using these library in either Asp.net Core, Azure Functions, and Linux based scenarios.
5645

57-
If your working against Dataverse Only and or custom entities and sdk messages, you should only need Microsoft.PowerPlatform.Dataverse.Client. If you do not experience that, or find missing messages in the Dataverse only scenarios, please let us know in the issues area.
58-
59-
<b>Note: We are currently providing support for these nuget packages primarily via GitHub and Microsoft Support.
46+
<b>Note: We provide support for these nuget packages primarily via GitHub and Microsoft Support.
6047
Github Issues is the preferred venue at this time as the development team is actively working on this library.
6148
A number of our dev's and PM's do monitor this channel and can respond to questions and feedback.
6249

63-
While we are monitoring the community forums, you are encouraged to open issue [here](https://github.com/microsoft/PowerPlatform-CdsServiceClient/issues)
50+
While we are monitoring the community forums, you are encouraged to open issue [here](https://github.com/microsoft/PowerPlatform-DataverseServiceClient/issues)
6451
</b>
6552

6653
## Samples / Docs
67-
Samples and such will be updated overtime on the PowerApps Samples GitHub Site as we move forward with the evolution of this capability. That said, any of the existing CrmServiceClient samples can be used as a base to start. You can find those here: [Samples](https://github.com/microsoft/PowerApps-Samples/tree/master/cds/orgsvc/C%23)
54+
Samples and such will be continually updated overtime on the PowerApps Samples GitHub Site. Dataverse ServiceClient Samples can be found here:[Samples](https://github.com/microsoft/PowerApps-Samples/tree/master/cds/orgsvc)
6855

69-
For connections strings, docs on supported patterns are here: [Connection String Docs](https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/xrm-tooling/use-connection-strings-xrm-tooling-connect)
56+
For connections strings, docs on supported patterns are here: [Connection String Docs](https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/xrm-tooling/use-connection-strings-xrm-tooling-connect). This link will be updated as Dataverse Specific connection string documentation comes online.
7057

7158
Microsoft Documentation root for Dataverse ServiceClient can be found here: [Dataverse ServiceClient Docs](https://docs.microsoft.com/en-us/dotnet/api/microsoft.powerplatform.dataverse.client?view=dataverse-sdk-latest)
7259

global.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"sdk": {
3+
"version": "6.0.202",
4+
"rollForward": "latestFeature",
5+
"allowPrerelease": false
6+
}
7+
}

src/Build.Shared.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
<PackageVersion_AppInsights>2.9.1</PackageVersion_AppInsights>
66
<PackageVersion_Adal>3.19.8</PackageVersion_Adal>
77
<PackageVersion_MSAL>4.35.1</PackageVersion_MSAL>
8-
<PackageVersion_CdsSdk>4.7.7698-v9.0-master.release</PackageVersion_CdsSdk>
9-
<PackageVersion_CrmProxy>4.7.7698-v9.0-master.release</PackageVersion_CrmProxy>
8+
<PackageVersion_CdsSdk>4.7.9489-v9.0-master</PackageVersion_CdsSdk>
9+
<PackageVersion_CrmProxy>4.7.9409-v9.0-master</PackageVersion_CrmProxy>
1010
<PackageVersion_CDSServerNuget>4.6.6061-weekly-2108.5</PackageVersion_CDSServerNuget>
1111
<PackageVersion_CdsSdkProxy>4.7.6346-master</PackageVersion_CdsSdkProxy>
1212
<PackageVersion_Newtonsoft>11.0.2</PackageVersion_Newtonsoft>
1313
<PackageVersion_RestClientRuntime>2.3.20</PackageVersion_RestClientRuntime>
1414
<PackageVersion_XrmSdk>9.0.2.42</PackageVersion_XrmSdk>
1515
<PackageVersion_Dep_OutlookXrmSdk>9.0.2.34</PackageVersion_Dep_OutlookXrmSdk>
16-
<PackageVersion_BatchedTelemetry>2.0.11</PackageVersion_BatchedTelemetry>
16+
<PackageVersion_BatchedTelemetry>2.0.19</PackageVersion_BatchedTelemetry>
1717
<PackageVersion_DataverseClient>0.4.20</PackageVersion_DataverseClient>
1818
<PackageVersion_CoverletCollector>3.1.0</PackageVersion_CoverletCollector>
1919
<PackageVersion_Microsoft_Extensions>3.1.8</PackageVersion_Microsoft_Extensions>

src/GeneralTools/DataverseClient/Client/ConnectionService.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,6 @@ internal string EnvironmentId
578578
internal Func<string, Task<string>> GetAccessTokenAsync { get; set; }
579579

580580

581-
//TODO: COMPLETE EXPOSURE OF ADDITIONAL HEADER FEATURE
582581
/// <summary>
583582
/// Function to call to get the current headers for this request
584583
/// </summary>
@@ -2307,7 +2306,7 @@ private bool ShouldRetryWebAPI(Exception ex, int retryCount, int maxRetryCount,
23072306
if (httpOperationException.Response.Headers.ContainsKey("Retry-After"))
23082307
_retryPauseTimeRunning = TimeSpan.Parse(httpOperationException.Response.Headers["Retry-After"].FirstOrDefault());
23092308
else
2310-
_retryPauseTimeRunning = retryPauseTime; // default timespan.
2309+
_retryPauseTimeRunning = retryPauseTime.Add(TimeSpan.FromSeconds(Math.Pow(2, retryCount))); ; // default timespan with back off is response does not contain the tag..
23112310
}
23122311
else
23132312
{
@@ -3330,7 +3329,14 @@ private async Task<OrgList> FindDiscoveryServerAsync(DiscoveryServers onlineServ
33303329
foreach (var itm in discoverResult.OrganizationDetailCollection)
33313330
{
33323331
var orgObj = Utilities.DeterminDiscoveryDataFromOrgDetail(new Uri(itm.Endpoints[EndpointType.OrganizationService]), out isOnPrem);
3333-
AddOrgToOrgList(itm, orgObj.DisplayName, ref orgsList);
3332+
if (orgObj != null)
3333+
{
3334+
AddOrgToOrgList(itm, orgObj.DisplayName, ref orgsList);
3335+
}
3336+
else
3337+
{
3338+
AddOrgToOrgList(itm, !string.IsNullOrEmpty(itm.Geo) ? itm.Geo : "Unknown", ref orgsList);
3339+
}
33343340
}
33353341
}
33363342
return orgsList;
@@ -3390,9 +3396,16 @@ private async Task<bool> QueryOnlineServersListAsync(ObservableCollection<Discov
33903396
foreach (var itm in discoverResult.OrganizationDetailCollection)
33913397
{
33923398
var orgObj = Utilities.DeterminDiscoveryDataFromOrgDetail(new Uri(itm.Endpoints[EndpointType.OrganizationService]), out isOnPrem);
3393-
if (trimToDiscoveryUri != null && !trimToDiscoveryUri.Equals(orgObj.DiscoveryServerUri))
3394-
continue;
3395-
AddOrgToOrgList(itm, orgObj.DisplayName, ref orgsList);
3399+
if (orgObj != null)
3400+
{
3401+
if (trimToDiscoveryUri != null && !trimToDiscoveryUri.Equals(orgObj.DiscoveryServerUri))
3402+
continue;
3403+
AddOrgToOrgList(itm, orgObj.DisplayName, ref orgsList);
3404+
}
3405+
else
3406+
{
3407+
AddOrgToOrgList(itm, !string.IsNullOrEmpty(itm.Geo) ? itm.Geo : "Unknown", ref orgsList);
3408+
}
33963409
}
33973410
}
33983411
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Microsoft.Extensions.DependencyInjection;
7+
using Microsoft.PowerPlatform.Dataverse.Client.Model;
8+
9+
namespace Microsoft.PowerPlatform.Dataverse.Client
10+
{
11+
/// <summary>
12+
/// TBD
13+
/// </summary>
14+
public class DataverseServiceClientBuilder
15+
{
16+
private ConnectionOptions _connectionOptions;
17+
18+
/// <summary>
19+
///
20+
/// </summary>
21+
/// <param name="connectionOptions"></param>
22+
internal DataverseServiceClientBuilder(ConnectionOptions connectionOptions)
23+
{
24+
_connectionOptions = connectionOptions;
25+
throw new NotImplementedException("In Development - Not for use.");
26+
27+
}
28+
29+
/// <summary>
30+
///
31+
/// </summary>
32+
/// <param name="connectionOptions"></param>
33+
/// <returns></returns>
34+
public static DataverseServiceClientBuilder Create(ConnectionOptions connectionOptions)
35+
{
36+
return new DataverseServiceClientBuilder(connectionOptions);
37+
}
38+
39+
}
40+
41+
/// <summary>
42+
/// TBD
43+
/// </summary>
44+
public static class ServiceCollectionExtentions
45+
{
46+
/// <summary>
47+
/// TBD
48+
/// </summary>
49+
/// <param name="services"></param>
50+
/// <param name="connectionOptions"></param>
51+
/// <returns></returns>
52+
public static IServiceCollection AddDataverseServiceClient(
53+
this IServiceCollection services,
54+
Action<ConnectionOptions> connectionOptions)
55+
{
56+
throw new NotImplementedException("In Development - Not for use.");
57+
58+
//services.Configure(connectionOptions);
59+
60+
61+
// Register lib services here...
62+
// services.AddScoped<ILibraryService, DefaultLibraryService>();
63+
64+
//return services;
65+
}
66+
}
67+
68+
69+
}

src/GeneralTools/DataverseClient/Client/Extensions/BatchExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ internal static bool AddRequestToBatch(this ServiceClient serviceClient, Guid ba
295295
// if request should bypass plugin exec.
296296
if (bypassPluginExecution &&
297297
Utilities.FeatureVersionMinimums.IsFeatureValidForEnviroment(serviceClient.ConnectedOrgVersion, Utilities.FeatureVersionMinimums.AllowBypassCustomPlugin))
298-
req.Parameters.Add(Utilities.RequestHeaders.BYPASSCUSTOMPLUGINEXECUTION, true);
298+
req.Parameters[Utilities.RequestHeaders.BYPASSCUSTOMPLUGINEXECUTION] = true;
299299

300300
if (serviceClient.IsBatchOperationsAvailable)
301301
{

src/GeneralTools/DataverseClient/Client/Extensions/CRUDExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static class CRUDExtentions
5858
createReq.Target = NewEnt;
5959
createReq.Parameters.Add("SuppressDuplicateDetection", !enabledDuplicateDetection);
6060
if (!string.IsNullOrWhiteSpace(applyToSolution))
61-
createReq.Parameters.Add(Utilities.RequestHeaders.SOLUTIONUNIQUENAME, applyToSolution);
61+
createReq.Parameters[Utilities.RequestHeaders.SOLUTIONUNIQUENAME] = applyToSolution;
6262

6363
CreateResponse createResp = null;
6464

src/GeneralTools/DataverseClient/Client/Model/ConfigurationOptions.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,28 @@ namespace Microsoft.PowerPlatform.Dataverse.Client.Model
1414
/// </summary>
1515
public class ConfigurationOptions
1616
{
17+
/// <summary>
18+
/// Updates the instance of Options with a previously created Options Object.
19+
/// </summary>
20+
/// <param name="options">PreLoaded Options Array</param>
21+
public void UpdateOptions(ConfigurationOptions options)
22+
{
23+
if (options != null)
24+
{
25+
EnableAffinityCookie = options.EnableAffinityCookie;
26+
MaxBufferPoolSizeOveride = options.MaxBufferPoolSizeOveride;
27+
MaxFaultSizeOverride = options.MaxFaultSizeOverride;
28+
MaxReceivedMessageSizeOverride = options.MaxReceivedMessageSizeOverride;
29+
MaxRetryCount = options.MaxRetryCount;
30+
MSALEnabledLogPII = options.MSALEnabledLogPII;
31+
MSALRequestTimeout = options.MSALRequestTimeout;
32+
MSALRetryCount = options.MSALRetryCount;
33+
RetryPauseTime = options.RetryPauseTime;
34+
UseWebApi = options.UseWebApi;
35+
UseWebApiLoginFlow = options.UseWebApiLoginFlow;
36+
}
37+
}
38+
1739
#region Dataverse Interaction Settings
1840
private int _maxRetryCount = Utils.AppSettingsHelper.GetAppSetting("ApiOperationRetryCountOverride", 10);
1941

@@ -139,7 +161,7 @@ public TimeSpan MSALRequestTimeout
139161
/// <summary>
140162
/// Number of retries to Get a token from MSAL.
141163
/// </summary>
142-
public int MsalRetryCount
164+
public int MSALRetryCount
143165
{
144166
get => _msalRetryCount;
145167
set => _msalRetryCount = value;

0 commit comments

Comments
 (0)