EC.DynamicsClient 5.6.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package EC.DynamicsClient --version 5.6.1
                    
NuGet\Install-Package EC.DynamicsClient -Version 5.6.1
                    
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.6.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EC.DynamicsClient" Version="5.6.1" />
                    
Directory.Packages.props
<PackageReference Include="EC.DynamicsClient" />
                    
Project file
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.6.1
                    
#r "nuget: EC.DynamicsClient, 5.6.1"
                    
#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.6.1
                    
#: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.6.1
                    
Install as a Cake Addin
#tool nuget:?package=EC.DynamicsClient&version=5.6.1
                    
Install as a Cake Tool

Introduction

This library Dynamics Client wraps calls to Dynamics 365 so you can use this to extend Dynamics 365.

Getting Started

Code Samples

Startup

namespace EC.DynamicsClient.CodeSamples;

using EC.DynamicsClient;

using Microsoft.Extensions.DependencyInjection;

public static class Startup_Code_Samples
{
    public static IServiceCollection Default(this IServiceCollection services) => services
        .AddDynamicsClients();

    public static IServiceCollection 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);
}

Query Client Usage

namespace EC.DynamicsClient.CodeSamples;

using EC.DynamicsClient;

using Microsoft.Extensions.Logging;

using System;
using System.Threading.Tasks;

public static class Query_Client_Usage_Code_Samples
{
    public static async Task Query_Client_Usage(
        IDynamicsQueryClient dynamicsQueryClient,
        ILogger log)
    {
        var fake_user = Guid.Empty;

        var result = await dynamicsQueryClient
            .Get_Safe<Contact>(ContactField
                .EntitySetName
                .Query()
                .Where([ // sample filter records
                    ContactField.FullName.Not_Equal_Null(),
                    ContactField.FullName.Contain("Bob"),
                    ContactField.FullName.Starts_With("Dan"),
                    ContactField.OwnerId.Not_Equal_Null(),
                    ContactField.OwnerId.Equal_User_Id(),
                    ContactField.CreatedBy.Not_Equal(fake_user)
                ])
                .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);

        result.Switch(
            invalid => log.LogWarning("The query that was provided is invalid."),
            contacts =>
            {
                if (contacts?.Entities is not null)
                {
                    foreach (var contact in contacts.Entities)
                    {
                        // do something with the contact
                    }
                }
            },
            not_found => log.LogWarning("The query that was provided did not return any results."),
            failed => log.LogError("The query that was provided resulted in a failed status response."));
    }
}

Manager Client Usage

namespace EC.DynamicsClient.CodeSamples;

using EC.DynamicsClient;

using Microsoft.Extensions.Logging;

using System.Threading.Tasks;

public static class Manager_Client_Usage_Code_Samples
{
    public static async Task Manager_Client_Usage(
        IDynamicsManagerClient dynamicsManagerClient,
        ILogger log)
    {
        var result = await dynamicsManagerClient
            .Create_Safe(new CreateRequest<Contact>(ContactField.EntitySetName, new Contact()
            {
                FirstName = "test first name",
                LastName = "test last name",
            }, headerSet: new HeaderSet([new AddPrefer([new ReturnRepresentation()])])
        )).ConfigureAwait(false);

        result.Switch(
            success => log.LogInformation("The create request provided completed successfully."),
            contact =>
            {
                log.LogInformation("The create request provided completed successfully with the updated contact.");
                // do something with the contact
                var created_contact = contact.Value;
                var contactId = created_contact.ContactId;
                var fullName = created_contact.FullName;
            },
            invalid => log.LogWarning("The create request that was provided is invalid."),
            failed => log.LogError("The create request that was provided resulted in a failed status response.")
        );
    }
}
Product 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.

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 788 12/9/2024
5.6.3 174 11/26/2024
5.6.1 164 11/19/2024
5.6.0 179 11/11/2024
5.5.0 458 10/14/2024
5.4.0 526 9/20/2024
5.3.2 175 8/30/2024
5.3.1 522 5/13/2024
5.2.4 1,177 4/9/2024
5.2.3 201 3/24/2024
5.2.2 191 3/24/2024
5.1.3 599 3/19/2024
5.1.2 234 3/9/2024
5.1.1 212 3/7/2024
5.0.4 207 3/3/2024
Loading failed