EC.DynamicsClient
5.4.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package EC.DynamicsClient --version 5.4.0
NuGet\Install-Package EC.DynamicsClient -Version 5.4.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EC.DynamicsClient" Version="5.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EC.DynamicsClient" Version="5.4.0" />
<PackageReference Include="EC.DynamicsClient" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EC.DynamicsClient --version 5.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EC.DynamicsClient, 5.4.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EC.DynamicsClient@5.4.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EC.DynamicsClient&version=5.4.0
#tool nuget:?package=EC.DynamicsClient&version=5.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Introduction
This library Dynamics Client wraps calls to Dynamics 365 so you can use this to extend Dynamics 365.
Getting Started
Code Samples
namespace EC.DynamicsClient.CodeSamples;
using EC.DynamicsClient;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
/// <summary>
/// Dynamics Client Code Samples
/// </summary>
public static class Dynamics_Client_Code_Samples
{
/// <summary>
/// Default Dynamics Client Setup Startup
/// </summary>
/// <param name="services">The service collection</param>
/// <returns>The updated service collection</returns>
public static IServiceCollection Default_Dynamics_Client_Setup_Startup(
this IServiceCollection services) => services
.AddDynamicsClients();
/// <summary>
/// Default Dynamics Client Setup Startup with Keys
/// </summary>
/// <param name="services">The service collection</param>
/// <param name="authorityKeyName">The authority key name</param>
/// <param name="clientIdKeyName">The client ID key name</param>
/// <param name="clientSecretKeyName">The client secret key name</param>
/// <param name="serviceEndpointKeyName">The service endpoint key name</param>
/// <param name="scopesKeyName">The scopes key name</param>
/// <param name="retryCountKeyName">The retry count key name</param>
/// <returns>The updated service collection</returns>
public static IServiceCollection Default_Dynamics_Client_Setup_Startup_with_Keys(
this IServiceCollection services,
string authorityKeyName, string clientIdKeyName, string clientSecretKeyName,
string serviceEndpointKeyName, string scopesKeyName, string retryCountKeyName)
=> services
.AddDynamicsClients(
authorityKeyName,
clientIdKeyName,
clientSecretKeyName,
serviceEndpointKeyName,
scopesKeyName,
retryCountKeyName);
/// <summary>
/// Default Dynamics Query Client Usage
/// </summary>
/// <param name="dynamicsQueryClient">The dynamics query client</param>
/// <returns>A task representing the asynchronous operation</returns>
public static async Task Default_Dynamics_Query_Client_Usage(
IDynamicsQueryClient dynamicsQueryClient)
{
try
{
var entityCollection = await dynamicsQueryClient.ThrowIfNull()
.Get<Contact>(
ContactField.EntitySetName
.Query()
.Where([ // sample filter records
ContactField.FullName.Contain("Bob"),
ContactField.FullName.Starts_With("Dan"),
ContactField.OwnerId.Equal_User_Id()
])
.Top(10)
.Select([ // sample select fields
ContactField.FirstName,
ContactField.LastName,
ContactField.ContactId,
ContactField.CreatedBy.ToLookup(),
])
.OrderBy([ // sample order by expressions
ContactField.CreatedBy.Order_By()
])
.ExpandOn( // sample expand on expressions
ContactField.ec_Account
.Expand()
.Select([AccountField.AccountId])
.Where([
AccountField.OwnerId.Equal_User_Id()
])
.Build())
.Where([ // sample lambda expressions
Lambda.All(ContactOneToMany.account_primary_contact, [
Lambda.StartsWith(AccountField.Name, "S"),
Lambda.EndsWith(AccountField.Name, "h"),
Lambda.Contains(AccountField.Name, "Smith"),
Lambda.Equals(AccountField.StatusCode, account_statuscode.Active),
new EqualsLambdaExpression("null", "null")
]),
])
.Build())
.ConfigureAwait(false);
if (entityCollection?.Entities is not null)
{
foreach (var item in entityCollection.Entities)
{
}
}
}
catch (FailedStatusCodeException exception)
{
var dynamics_error_message = exception.Error?.GetMessage();
var dynamics_error_stacktrace = exception.Error?.GetStackTrace();
}
}
/// <summary>
/// Default Dynamics Manager Client Usage
/// </summary>
/// <param name="dynamicsManagerClient">The dynamics manager client</param>
/// <returns>A task representing the asynchronous operation</returns>
public static async Task Default_Dynamics_Manager_Client_Usage(
IDynamicsManagerClient dynamicsManagerClient)
{
try
{
var createResponse = await dynamicsManagerClient.ThrowIfNull()
.Create(new CreateRequest<Contact>(ContactField.EntitySetName, new()
{
FirstName = "test first name",
LastName = "test last name",
}, headerSet: new HeaderSet([new AddPrefer([new ReturnRepresentation()])])
)).ConfigureAwait(false);
var created_contact = await createResponse.GetData().ConfigureAwait(false);
var contact_id = created_contact?.ContactId;
}
catch (FailedStatusCodeException exception)
{
var error_message = exception.Error?.GetMessage();
var error_stack_trace = exception.Error?.GetStackTrace();
}
}
}
Contribute
To Contribute, clone repository locally then create a new branch from master/main and make any changes on that branch. When happy with changes create pull request for review.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- EC.Common (>= 2024.3.19.1)
- Microsoft.AspNet.WebApi.Client (>= 6.0.0)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.0)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 8.0.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.Extensions.Http.Polly (>= 8.0.8)
- Microsoft.Extensions.Logging.Console (>= 8.0.0)
- Microsoft.Identity.Client (>= 4.64.0)
- System.Net.Http.Json (>= 8.0.0)
- System.Text.Json (>= 8.0.4)
- System.Threading.Channels (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
5.7.0 | 292 | 12/9/2024 |
5.6.3 | 118 | 11/26/2024 |
5.6.1 | 105 | 11/19/2024 |
5.6.0 | 121 | 11/11/2024 |
5.5.0 | 250 | 10/14/2024 |
5.4.0 | 243 | 9/20/2024 |
5.3.2 | 126 | 8/30/2024 |
5.3.1 | 402 | 5/13/2024 |
5.2.4 | 897 | 4/9/2024 |
5.2.3 | 140 | 3/24/2024 |
5.2.2 | 120 | 3/24/2024 |
5.1.3 | 438 | 3/19/2024 |
5.1.2 | 176 | 3/9/2024 |
5.1.1 | 157 | 3/7/2024 |
5.0.4 | 158 | 3/3/2024 |
4.4.1 | 504 | 11/22/2023 |
4.3.1 | 156 | 11/22/2023 |
4.2.3 | 331 | 8/16/2023 |
4.2.2 | 687 | 8/13/2023 |
4.2.1 | 266 | 7/23/2023 |
4.1.4 | 248 | 7/21/2023 |
4.1.3 | 232 | 7/20/2023 |
4.1.2 | 238 | 7/16/2023 |
4.1.1 | 240 | 7/12/2023 |
4.1.0 | 254 | 7/6/2023 |
4.0.0 | 220 | 6/26/2023 |
3.14.1 | 280 | 6/17/2023 |
3.13.1 | 232 | 5/25/2023 |
3.12.5 | 340 | 3/18/2023 |
3.12.4 | 322 | 3/14/2023 |
3.12.3 | 323 | 3/13/2023 |
3.12.2 | 342 | 3/9/2023 |
3.12.1 | 1,237 | 11/12/2022 |
3.12.0 | 453 | 11/12/2022 |
3.11.0 | 474 | 11/10/2022 |
3.10.0 | 534 | 10/22/2022 |
3.9.0 | 498 | 10/17/2022 |
3.8.0 | 2,446 | 8/16/2021 |
3.7.6 | 524 | 8/2/2021 |
3.7.5 | 492 | 8/2/2021 |
3.7.4 | 954 | 6/30/2021 |
3.7.3 | 496 | 6/30/2021 |
3.7.1 | 974 | 6/19/2021 |
3.4.1 | 544 | 5/31/2021 |
3.4.0 | 495 | 4/14/2021 |
3.3.1 | 544 | 4/1/2021 |
3.3.0 | 531 | 3/19/2021 |
3.2.2 | 610 | 2/17/2021 |
3.2.1 | 489 | 2/17/2021 |
3.2.0 | 480 | 2/14/2021 |
3.1.0 | 465 | 2/14/2021 |
3.0.1.5 | 512 | 2/11/2021 |
2.2.1 | 597 | 3/4/2022 |