EmBrito.Dataverse.Extensions.Data 1.0.1

.NET 6.0 .NET Framework 4.6.2
dotnet add package EmBrito.Dataverse.Extensions.Data --version 1.0.1
NuGet\Install-Package EmBrito.Dataverse.Extensions.Data -Version 1.0.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="EmBrito.Dataverse.Extensions.Data" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EmBrito.Dataverse.Extensions.Data --version 1.0.1
#r "nuget: EmBrito.Dataverse.Extensions.Data, 1.0.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.
// Install EmBrito.Dataverse.Extensions.Data as a Cake Addin
#addin nuget:?package=EmBrito.Dataverse.Extensions.Data&version=1.0.1

// Install EmBrito.Dataverse.Extensions.Data as a Cake Tool
#tool nuget:?package=EmBrito.Dataverse.Extensions.Data&version=1.0.1


Data utilities for Dateverse client applications and plugin development.


Entity Mapper

Use a convetion based approach to data mapping and transformation by annotating your data transfer object. The mapper will automatically transform the data between between the column and property types while also giving access to Dataverse formatted values and string formatting.

// Sample class with the data annotation,
public class AccountDto : EntityMapper<AccountDto>
    public string Name { get; set; }

    [FromOptionSetColumn("industrycode", formattedValue: true)]
    public string IndustryCode { get; set; }

    [FromOptionSetColumn("createdon", format: "yyyy-MM-dd")]
    public string DateCreated { get; set; }    

    public decimal? Revenue { get; set; }

    public int State { get; set; }

    public AccountDto(Entity entity) : base(entity) {}

In this example an instance of the DTO is created from an account entity and then serialized to JSON:

Entity account = crmServiceClient.Retrieve("account", accountId, new ColumnSet(true));
AccountDto dto = new AccountDto(account);

// serializing the mapped object
string jsonString = JsonSerializer.Serialize(dto);

The JSON should look like this:

    "Name": "Contoso",
    "IndustryCode": "Business Services",
    "DateCreated": "2023-01-12",
    "Revenue": 3000000,
    "AccountState": 1

Visit the project website for detailed documentation.

Product 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. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Additional computed target framework(s)
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
1.0.1 364 1/13/2023
1.0.0 199 1/12/2023

 Project description and documentation update.
 Initial release.