ODataHttpClient.Generators 1.0.0-preview.1

This is a prerelease version of ODataHttpClient.Generators.
There is a newer version of this package available.
See the version list below for details.
dotnet add package ODataHttpClient.Generators --version 1.0.0-preview.1                
NuGet\Install-Package ODataHttpClient.Generators -Version 1.0.0-preview.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="ODataHttpClient.Generators" Version="1.0.0-preview.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ODataHttpClient.Generators --version 1.0.0-preview.1                
#r "nuget: ODataHttpClient.Generators, 1.0.0-preview.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 ODataHttpClient.Generators as a Cake Addin
#addin nuget:?package=ODataHttpClient.Generators&version=1.0.0-preview.1&prerelease

// Install ODataHttpClient.Generators as a Cake Tool
#tool nuget:?package=ODataHttpClient.Generators&version=1.0.0-preview.1&prerelease                

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 130 4/18/2024
1.0.1 220 9/29/2023
1.0.0 245 9/26/2023
1.0.0-preview.1 84 9/26/2023