ODataHttpClient.Generators 1.0.2

dotnet add package ODataHttpClient.Generators --version 1.0.2
NuGet\Install-Package ODataHttpClient.Generators -Version 1.0.2
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="ODataHttpClient.Generators" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ODataHttpClient.Generators --version 1.0.2
#r "nuget: ODataHttpClient.Generators, 1.0.2"
#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 ODataHttpClient.Generators as a Cake Addin
#addin nuget:?package=ODataHttpClient.Generators&version=1.0.2

// Install ODataHttpClient.Generators as a Cake Tool
#tool nuget:?package=ODataHttpClient.Generators&version=1.0.2

Test NuGet version

ODataHttpClient.Generators

Utilities of Source Generators for ODataHttpClient

Install

> dotnet add package ODataHttpClient

How to Use

Entity Generator

You add AdditionalFiles into your csproj and including metdata xml file.

<Project Sdk="Microsoft.NET.Sdk">
    ...
	<ItemGroup>
		<AdditionalFiles Include="data\ODataDemo.metadata.xml" />
	</ItemGroup>
    ...
</Project>

Pick Generator

You add Pick attribute. The target class must be partial class.

namespace Your.Project.Namespace;

[Pick<ODataDemo.Product>("ID","Name")]
public partial class ProductSummary {}

Then you can get a auto-generated file like as following.

// <auto-generated/>
#pragma warning disable CS8600
#pragma warning disable CS8601
#pragma warning disable CS8602
#pragma warning disable CS8603
#pragma warning disable CS8604

using System.Linq;

namespace Your.Project.Namespace;

public partial class ProductSummary
{
    public  int ID { get; set; }
    public  string? Name { get; set; }

    public void Assign(ODataDemo.Product src)
    {
        this.ID = src.ID;
        this.Name = src.Name;
        
    }

    public static ProductSummary Create(ODataDemo.Product src)
    {
        var obj = new ProductSummary();
        obj.Assign(src);
        return obj;
    }
}
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

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.2 76 4/18/2024
1.0.1 174 9/29/2023
1.0.0 201 9/26/2023
1.0.0-preview.1 67 9/26/2023