Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/GeneralTools/DataverseClient/UnitTests/LivePackageTestsConsole/bin/Debug/netcoreapp3.1/LivePackageTestsConsole.dll",
"args": [],
"cwd": "${workspaceFolder}/src/GeneralTools/DataverseClient/UnitTests/LivePackageTestsConsole",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
42 changes: 42 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/src/GeneralTools/DataverseClient/UnitTests/LivePackageTestsConsole/LivePackageTestsConsole.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/src/GeneralTools/DataverseClient/UnitTests/LivePackageTestsConsole/LivePackageTestsConsole.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/src/GeneralTools/DataverseClient/UnitTests/LivePackageTestsConsole/LivePackageTestsConsole.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
39 changes: 39 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<Project InitialTargets="VerifyBuildProps">
<!-- See: https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2019#directorybuildprops-and-directorybuildtargets -->
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<IsOfficialBuild Condition="'$(IsOfficialBuild)' == ''">false</IsOfficialBuild>

<!-- Because the default value in MSBuild doesn't get set until after Directory.Build.props, and we need it, we set the default here. -->
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
</PropertyGroup>

<PropertyGroup Label="Build layout">
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<SrcRoot>$(RepoRoot)src\</SrcRoot>
</PropertyGroup>

<PropertyGroup Label="Official build defaults" Condition="'$(IsOfficialBuild)' == 'true'">
<Enable_Telemetry>true</Enable_Telemetry>
</PropertyGroup>

<!-- Use our dev nuget config when requested. -->
<PropertyGroup Label="Dev Nuget config" Condition="'$(UseNugetDevConfig)' == 'true' and '$(IsOfficialBuild)' != 'true'">
<RestoreConfigFile Condition="'$(RestoreConfigFile)' == ''">$(RepoRoot)nuget.dev.config</RestoreConfigFile>

<!-- since we're using dev nuget packages, lets prevent dirtying up the local nuget cache folder -->
<RestorePackagesPath>$(RepoRoot)obj\.nuget-cache</RestorePackagesPath>
</PropertyGroup>

<Target Name="VerifyBuildProps">
<Error Condition="'$(isOfficialBuild)' == 'true' and '$(UseNugetDevConfig)' == 'true'"
Text="UseNugetDevConfig cannot be set for official builds." />
<Error Condition="'$(isOfficialBuild)' == 'true' and '$(PublishToDevNugetFeed)' == 'true'"
Text="PublishToDevNugetFeed cannot be set for official builds." />

<Error Condition="('$(UseNugetDevConfig)' == 'true' or '$(PublishToDevNugetFeed)' == 'true') and '$(NUGET_LOCAL_DEV_PACKAGES)' == ''"
Text="The environment variable 'NUGET_LOCAL_DEV_PACKAGES' is not set. This is required to use any of the arguments: UseNugetDevConfig, PublishToDevNugetFeed" />
<Error Condition="'$(NUGET_LOCAL_DEV_PACKAGES)' != '' and !Exists('$(NUGET_LOCAL_DEV_PACKAGES)')"
Text="The environment variable 'NUGET_LOCAL_DEV_PACKAGES' is set, but does not exist. Ensure it exists if specified." />
</Target>
</Project>
11 changes: 11 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project>
<!-- See: https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2019#directorybuildprops-and-directorybuildtargets -->
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>

<PropertyGroup Label="Build options for telemetry">
<!-- This needs to be done in .targets, as some projects set DefineConstants but don't concatenate with existing values. -->
<DefineConstants Condition="'$(Enable_Telemetry)' == 'true'">$(DefineConstants);PROD_CUSTOMER_TELEMETRY</DefineConstants>
</PropertyGroup>
</Project>
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Current release notes and change log:

[Microsoft.PowerPlatform.Dataverse.Client.Dynamics](src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.Dynamics.ReleaseNotes.txt)

[Microsoft.Dynamics.Sdk.Messages](src/nuspecs/Microsoft.Dynamics.Sdk.Messages.ReleaseNotes.txt)
This nuget package has been deprecated (for now) ~~[Microsoft.Dynamics.Sdk.Messages](src/nuspecs/Microsoft.Dynamics.Sdk.Messages.ReleaseNotes.txt)~~

## Overview
This repository contains the code for the Microsoft.PowerPlatform.Dataverse.Client and its supporting assemblies and classes.
Expand All @@ -27,34 +27,33 @@ This encompasses the contents of the following nuget packages:

[Microsoft.PowerPlatform.Dataverse.Client.Dynamics](https://www.nuget.org/packages/Microsoft.PowerPlatform.Dataverse.Client.Dynamics)

[Microsoft.Dynamics.Sdk.Messages](https://www.nuget.org/packages/Microsoft.Dynamics.Sdk.Messages)
This nuget package has been deprecated (for now) ~~[Microsoft.Dynamics.Sdk.Messages](https://www.nuget.org/packages/Microsoft.Dynamics.Sdk.Messages)~~


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.

We are using this effort to for a few key things we have wanted to get done for a number of years,

1. Refactor and update our client libraries to allow us to spit up Powerplatform Common Data Service SDK support from Microsoft Dynamics 365.
1. Refactor and update our client libraries to allow us to spit up PowerPlatform Common Data Service SDK support from Microsoft Dynamics 365.
2. Provide multi targeted library build that targets our supported .net client platforms.
3. Update connection patterns and behaviors to be consistent with many of the broadly accepted patterns.
4. Create a pattern to allow developers focus on the use of Common Data Service, or CDS + Dynamics as they need.
4. Create a pattern to allow developers focus on the use of Dataverse, or Dataverse + Dynamics as they need.

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.

At this time: (08/16/2021)
At this time: (03/06/2022)
The Client SDK libs supports the following and has the following notices:

* 0.6.x is **expected** to be the final preview release, followed by 1.0
* 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.
* .net full framework 4.6.2, 4.7.2, 4.8 and .net core 3.0, 3.1, 5.0, 6.0
* We now support all authentication types from CrmServiceClient, ( Client\Secret, Client\Cert, UID\PW Noninteractive, UID\PW interactive.)
* We now support all authentication types from CrmServiceClient for .net framework, ( Client\Secret, Client\Cert, UID\PW Noninteractive, UID\PW interactive.)
* We support the following authentication types from CrmServiceClient for .net core: Client\Secret, Client\Cert, UID\PW interactive.
* MSAL Port has been completed, this Lib is now using MSAL 4.35+
* The Message types that are part of the client have been reduced to Dataverse Core server messages only. Things like “QualifyLeadRequest” have been removed to their own Nuget package ( Microsoft.Dynamics.Sdk.Messages )
* We will likely ship more extension packages that will contain the “CRM” messages, though over time, we will likely split the namespaces of those messages up based on service line, think Field Service or Sales or Customer Service, etc..
* Plugin Development using this Client is NOT supported at this time.

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.

We believe for the vast majority of applications working against the older dynamices sdk libs, you should only need Microsoft.PowerPlatform.Dataverse.Client and Microsoft.Dynamics.Sdk.Messages.

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.

<b>Note: We are currently providing support for these nuget packages primarily via GitHub and Microsoft Support.
Expand Down
2 changes: 1 addition & 1 deletion src/Build.Common.core.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<PropertyGroup Condition="'$(ProjectSpecificFx)' == ''">
<TargetFrameworks>net462;net472;net48;netcoreapp3.0;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net462;net472;net48;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

Expand Down
2 changes: 2 additions & 0 deletions src/Build.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@

<Import Project=".\Build.Shared.props" />

<!-- TODO: Import Microsoft.Common.props BEFORE any other shared .props files in order to ensure correct ordering
semantics that exist between Sdk-style projects and non-Sdk-style projects for Directory.Build.props files. -->
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
</Project>
26 changes: 20 additions & 6 deletions src/Build.Shared.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<PackageVersion_AppInsights>2.9.1</PackageVersion_AppInsights>
<PackageVersion_Adal>3.19.8</PackageVersion_Adal>
<PackageVersion_MSAL>4.35.1</PackageVersion_MSAL>
<PackageVersion_CdsSdk>4.6.6061-weekly-2108.5</PackageVersion_CdsSdk>
<PackageVersion_CdsSdk>4.7.7698-v9.0-master.release</PackageVersion_CdsSdk>
<PackageVersion_CrmProxy>4.7.7698-v9.0-master.release</PackageVersion_CrmProxy>
<PackageVersion_CDSServerNuget>4.6.6061-weekly-2108.5</PackageVersion_CDSServerNuget>
<PackageVersion_CdsSdkProxy>4.7.6346-master</PackageVersion_CdsSdkProxy>
<PackageVersion_Newtonsoft>11.0.2</PackageVersion_Newtonsoft>
Expand Down Expand Up @@ -35,6 +36,22 @@
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
</PropertyGroup>

<PropertyGroup>
<!--
Create a corse level define to identity .net framework vs .net core

This is to align with https://github.com/dotnet/designs/blob/main/accepted/2020/or-greater-defines/or-greater-defines.md
which pre-defines some preprocessor symbols for source files.

Also this has to be defined in Directory.build.targets to ensure it is evaluated after evaluating all properties
in .csproj files.
-->
<NETFRAMEWORK Condition="$(TargetFramework.ToLower().StartsWith('net4'))">true</NETFRAMEWORK>
<NETFRAMEWORK Condition="!$(TargetFramework.ToLower().StartsWith('net4'))">false</NETFRAMEWORK>
<NETFRAMEWORK Condition="'$(NETFRAMEWORK)'==''">true</NETFRAMEWORK>
</PropertyGroup>


<PropertyGroup>
<!-- this property must be re-defined in individual .csprojs or a .props file per component area -->
<ComponentAreaName Condition="'$(ComponentAreaName)' == ''">FORGOT-To-Set-ComponentAreaName</ComponentAreaName>
Expand All @@ -43,7 +60,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<!-- These variables define the object and binary roots, respectively. -->
<RepoRoot>$([System.IO.Path]::GetFullPath($([System.IO.Path]::Combine($(MSBuildThisFileDirectory), ".."))))</RepoRoot>
<RepoRoot Condition="'$(RepoRoot)' == ''">$([System.IO.Path]::GetFullPath($([System.IO.Path]::Combine($(MSBuildThisFileDirectory), ".."))))</RepoRoot>
<OutputRootDir Condition=" '$(OutputRootDir)' == '' ">$(RepoRoot)\bin\$(Configuration)\$(ComponentAreaName)\$(TargetFramework)</OutputRootDir>
<OutputRootDir>$(OutputRootDir.TrimEnd({'\\'}))</OutputRootDir>
<!-- These variables are the ones that the standard MSBuild targets recognize. -->
Expand All @@ -63,6 +80,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NoWarn>$(NoWarn);CS8032</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down Expand Up @@ -102,8 +120,4 @@
<DefineConstants>DEBUG;TRACE;CRMINTERNAL</DefineConstants>
<Optimize>false</Optimize>
</PropertyGroup>

<PropertyGroup Condition=" '$(Enable_Telemetry)' == 'true' " >
<DefineConstants>$(DefineConstants);PROD_CUSTOMER_TELEMETRY</DefineConstants>
</PropertyGroup>
</Project>
16 changes: 16 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project>
<!-- See: https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2019#directorybuildprops-and-directorybuildtargets -->
<Import Project="$([MSBuild]::GetPathOfFileAbove($(MSBuildThisFile), '$(MSBuildThisFileDirectory)../'))" />

<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>

<PropertyGroup>
<!-- These variables define the object and binary roots, respectively. -->
<!-- The parent area folder name is intended to resolve potentially duplicate MSBuildProjectName's across the repo -->
<_parentAreaFolderName>$([System.IO.Path]::GetFileName( $([System.IO.Path]::GetFullPath( $([System.IO.Path]::Combine($(MSBuildProjectDirectory), "..")) )) ))</_parentAreaFolderName>
<!-- Setting the base obj folder to the root of the repo to help avoid build errors due to extremely long file paths -->
<BaseIntermediateOutputPath>$(RepoRoot)\obj\$(_parentAreaFolderName)\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
</PropertyGroup>
</Project>
7 changes: 4 additions & 3 deletions src/GeneralTools/DataverseClient/Client/Auth/AuthProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Identity.Client;
using Microsoft.PowerPlatform.Dataverse.Client.Auth.TokenCache;
using Microsoft.PowerPlatform.Dataverse.Client.InternalExtensions;
using Microsoft.PowerPlatform.Dataverse.Client.Utils;
using Microsoft.Xrm.Sdk.WebServiceClient;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -452,12 +452,13 @@ internal static UriBuilder GetUriBuilderWithVersion(Uri discoveryServiceUri)
/// <param name="targetServiceUrl">URI to query</param>
/// <param name="logger">Logger to write info too</param>
/// <param name="clientFactory">HTTP Client factory to use for this request.</param>
/// <param name="isOnPrem">if true, login is for an onprem server</param>
/// <returns></returns>
private static async Task<AuthenticationDetails> GetAuthorityFromTargetServiceAsync(IHttpClientFactory clientFactory, Uri targetServiceUrl, DataverseTraceLogger logger)
private static async Task<AuthenticationDetails> GetAuthorityFromTargetServiceAsync(IHttpClientFactory clientFactory, Uri targetServiceUrl, DataverseTraceLogger logger, bool isOnPrem = false)
{
var client = clientFactory.CreateClient("DataverseHttpClientFactory");
var resolver = new AuthorityResolver(client, (t, msg) => logger.Log(msg, t));
return await resolver.ProbeForExpectedAuthentication(targetServiceUrl);
return await resolver.ProbeForExpectedAuthentication(targetServiceUrl, isOnPrem);
}

/// <summary>
Expand Down
Loading