Skip to content

About

Typed .NET SDK sample for Dynamics 365 F&O integrations with authentication, retry policies, logging, HttpClientFactory and CI package validation.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Dynamics 365 Integration SDK

CI .NET NuGet Dynamics 365 License

A typed .NET SDK sample for Dynamics 365 Finance and Operations integrations. The repository demonstrates how to design reusable enterprise integration libraries without exposing client, employer or proprietary code.

SDK Pipeline

sequenceDiagram
    participant App as Consumer App
    participant SDK as DynamicsIntegration SDK
    participant Auth as Token Provider
    participant Retry as Retry Handler
    participant D365 as Dynamics 365 F&O

    App->>SDK: Customers.SearchAsync(query)
    SDK->>Auth: Get access token
    Auth-->>SDK: Bearer token
    SDK->>Retry: Send OData request
    Retry->>D365: GET /data/CustomersV3
    D365-->>Retry: Customer payload
    Retry-->>SDK: Typed response
    SDK-->>App: IReadOnlyCollection<Customer>
Loading

What It Shows

  • Typed services for customers, sales orders and invoices
  • OAuth client credentials token provider
  • Static token provider for tests and local demos
  • Bearer authentication DelegatingHandler
  • Correlation ID handler
  • Retry handler for transient failures and throttling
  • OData query builder
  • HttpClientFactory registration through dependency injection
  • Unit tests for handlers, token caching, OData query generation and service payloads
  • NuGet package metadata and CI pack validation

What This Demonstrates

  • Reusable SDK design with typed services and dependency injection registration.
  • Authentication, retry, correlation and OData concerns separated into composable handlers.
  • Testable HTTP integrations without depending on a real tenant or proprietary schemas.
  • Public package discipline through NuGet metadata and CI pack validation.

Install Locally

dotnet pack src/VictorSiqueira.DynamicsIntegration/VictorSiqueira.DynamicsIntegration.csproj --configuration Release --output artifacts/packages

Reference the generated package from artifacts/packages or reference the project directly while developing.

Usage

using VictorSiqueira.DynamicsIntegration;
using VictorSiqueira.DynamicsIntegration.Configuration;
using VictorSiqueira.DynamicsIntegration.Http;
using VictorSiqueira.DynamicsIntegration.Services;

services.AddDynamicsIntegration(options =>
{
    options.BaseAddress = new Uri("https://contoso.operations.dynamics.com/");
    options.LegalEntity = "usmf";
    options.Authentication = new DynamicsAuthenticationOptions
    {
        TenantId = "<tenant-id>",
        ClientId = "<client-id>",
        ClientSecret = "<client-secret>",
        Scope = "https://operations.dynamics.com/.default"
    };
});

var client = serviceProvider.GetRequiredService<IDynamicsIntegrationClient>();

var customers = await client.Customers.SearchAsync(
    ODataQuery.Empty
        .Select("CustomerAccount", "OrganizationName", "CurrencyCode")
        .Where("CurrencyCode eq 'USD'")
        .Top(25));

Static Token Mode

services.AddDynamicsIntegration(options =>
{
    options.BaseAddress = new Uri("https://contoso.operations.dynamics.com/");
    options.LegalEntity = "usmf";
    options.Authentication.Mode = DynamicsAuthenticationMode.StaticAccessToken;
    options.Authentication.StaticAccessToken = "<access-token>";
});

Project Structure

src/
  VictorSiqueira.DynamicsIntegration/
    Authentication/
    Configuration/
    Http/
    Models/
    Services/
tests/
  VictorSiqueira.DynamicsIntegration.Tests/

Design details are documented in docs/design.md.

Test

dotnet restore Dynamics365IntegrationSdk.slnx
dotnet format Dynamics365IntegrationSdk.slnx --verify-no-changes
dotnet build Dynamics365IntegrationSdk.slnx --configuration Release
dotnet test Dynamics365IntegrationSdk.slnx --configuration Release --no-build
dotnet pack src/VictorSiqueira.DynamicsIntegration/VictorSiqueira.DynamicsIntegration.csproj --configuration Release --no-build --output artifacts/packages

Security Notes

Never commit real tenant IDs, client IDs, client secrets, access tokens or customer endpoints. The values in this README are placeholders only.

Author & Contact

Built and maintained by Victor Henrique de Siqueira.

Portfolio Notice

This repository is part of a public enterprise software portfolio. It uses fictitious integration examples and does not contain client, employer or proprietary code.

About

Typed .NET SDK sample for Dynamics 365 F&O integrations with authentication, retry policies, logging, HttpClientFactory and CI package validation.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages