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.
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>
- 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
HttpClientFactoryregistration through dependency injection- Unit tests for handlers, token caching, OData query generation and service payloads
- NuGet package metadata and CI pack validation
- 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.
dotnet pack src/VictorSiqueira.DynamicsIntegration/VictorSiqueira.DynamicsIntegration.csproj --configuration Release --output artifacts/packagesReference the generated package from artifacts/packages or reference the project directly while developing.
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));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>";
});src/
VictorSiqueira.DynamicsIntegration/
Authentication/
Configuration/
Http/
Models/
Services/
tests/
VictorSiqueira.DynamicsIntegration.Tests/
Design details are documented in docs/design.md.
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/packagesNever commit real tenant IDs, client IDs, client secrets, access tokens or customer endpoints. The values in this README are placeholders only.
Built and maintained by Victor Henrique de Siqueira.
- Email: victor.h.siqueira@hotmail.com
- Phone / WhatsApp: +55 11 94340-3468
- GitHub: vsiqueiravh-cell
This repository is part of a public enterprise software portfolio. It uses fictitious integration examples and does not contain client, employer or proprietary code.