BauerApps.DataverseODataClient
2.0.2
dotnet add package BauerApps.DataverseODataClient --version 2.0.2
NuGet\Install-Package BauerApps.DataverseODataClient -Version 2.0.2
<PackageReference Include="BauerApps.DataverseODataClient" Version="2.0.2" />
<PackageVersion Include="BauerApps.DataverseODataClient" Version="2.0.2" />
<PackageReference Include="BauerApps.DataverseODataClient" />
paket add BauerApps.DataverseODataClient --version 2.0.2
#r "nuget: BauerApps.DataverseODataClient, 2.0.2"
#:package BauerApps.DataverseODataClient@2.0.2
#addin nuget:?package=BauerApps.DataverseODataClient&version=2.0.2
#tool nuget:?package=BauerApps.DataverseODataClient&version=2.0.2
Dataverse OData Client
This NuGet package provides a ready-to-use OData Client for Microsoft Dataverse Web API.
Features
- based on the very popular and feature-rich Simple.OData.Client
- seamless integration in dependency injection and configuration concepts of .NET
- makes use of
IHttpClientFactoryto delegateHttpClientlifecycle to framework - token handling based on Azure Identity, which offers various ways to authenticate against Dataverse
- supports e2e-traceability of requests via correlation id
- developed and targeted at Azure Functions and Azure Web Apps
Get started
To get started with this package just install the latest version from NuGet using the dotnet CLI:
dotnet add package BauerApps.DataverseODataClient
After installation you can register the client in Startup.cs...
using System;
using DataverseODataClient.Extensions;
using Microsoft.Extensions.DependencyInjection;
namespace DataverseODataClient.Sample
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddDataverseODataClient(options =>
{
options.OrganizationUrl = new Uri("https://my-organization.crm4.dynamics.com");
options.ManagedIdentityClientId = "d0f19fa6-76ef-46cb-93ac-fcde5a4a6143"; // optional
});
}
}
}
... and inject it for example into your Controller. As mentioned above this client basically is a preconfigured
version of Simple.OData.Client, which means you can use it the same way. If you are new to Simple.OData.Client head
over to the wiki for available features.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Simple.OData.Client;
namespace DataverseODataClient.Sample.Controllers
{
[ApiController]
[Route("[controller]")]
public class SampleController : ControllerBase
{
private readonly IODataClient _client;
public SampleController(IODataClient client)
{
_client = client;
}
[HttpGet]
public async Task<Account> Get(string id)
{
return await _client
.For<Account>()
.Key(id)
.FindEntryAsync();
}
}
}
Configuration
You can configure Dataverse OData Client using DataverseODataClientOptions
| Option | Required | Description |
|---|---|---|
| OrganizationUrl | ✔ | The base url of your Dataverse organization |
| ManagedIdentityClientId | When using a Azure user-assigned managed identity for authentication you have to specify the client id of the corresponding managed identity. |
Correlation Id
It is possible to pass a correlation id to Dataverse by registering a implementation of ICorrelationIdProvider. The id is then available as tag parameter in the shared variables. See Dataverse docs for details.
// sample correlation id provider
public class HttpHeaderCorrelationIdProvider : ICorrelationIdProvider
{
private readonly IHttpContextAccessor _httpContextAccessor;
public HttpHeaderCorrelationIdProvider(IHttpContextAccessor httpContextAccessor)
{
_httpContextAccessor = httpContextAccessor;
}
public string GetCorrelationId()
{
// extract correlation id from http header
return _httpContextAccessor.HttpContext?.Request.Headers["x-correlation-id"];
}
}
// register in Program.cs
services.AddDataverseODataClient(options => { ... });
services.AddTransient<ICorrelationIdProvider, HttpHeaderCorrelationIdProvider>();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. 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. |
-
net6.0
- Azure.Identity (>= 1.10.4)
- Microsoft.AspNetCore (>= 2.2.0)
- Microsoft.Extensions.Caching.Memory (>= 7.0.0)
- Microsoft.Extensions.Http (>= 7.0.0)
- Simple.OData.V4.Client (>= 6.0.1)
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 |
|---|---|---|
| 2.0.2 | 1,166 | 11/14/2023 |
| 2.0.1 | 465 | 11/8/2022 |
| 2.0.0 | 458 | 11/8/2022 |
| 1.0.10 | 616 | 4/8/2022 |
| 1.0.9 | 782 | 9/29/2021 |
| 1.0.8 | 503 | 9/21/2021 |
| 1.0.7 | 618 | 2/19/2021 |
| 1.0.6 | 588 | 2/5/2021 |
| 1.0.5 | 525 | 2/5/2021 |
| 1.0.4 | 496 | 2/5/2021 |
| 1.0.3 | 520 | 2/5/2021 |
| 1.0.2 | 495 | 2/5/2021 |
| 1.0.1 | 476 | 2/5/2021 |
| 1.0.0 | 506 | 2/5/2021 |