Hsu.Sg.Proxy 2023.412.21

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Hsu.Sg.Proxy --version 2023.412.21                
NuGet\Install-Package Hsu.Sg.Proxy -Version 2023.412.21                
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="Hsu.Sg.Proxy" Version="2023.412.21">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Hsu.Sg.Proxy --version 2023.412.21                
#r "nuget: Hsu.Sg.Proxy, 2023.412.21"                
#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 Hsu.Sg.Proxy as a Cake Addin
#addin nuget:?package=Hsu.Sg.Proxy&version=2023.412.21

// Install Hsu.Sg.Proxy as a Cake Tool
#tool nuget:?package=Hsu.Sg.Proxy&version=2023.412.21                

Hsu.Sg.Proxy

Generate a proxy object from a struct or class or interface.

Package Version

Name Source Stable Preview
Hsu.Sg.Proxy Nuget NuGet NuGet
Hsu.Sg.Proxy MyGet MyGet MyGet

Usages

Install

  • Hsu.Sg.Proxy

You can install the package from nuget.

<PackageReference Include="Hsu.Sg.Proxy" Version="2023.412.12">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

Attributes

Add the Proxy attribute and partial keyword to the class or struct or interface.

[Proxy]
public partial class ClassSamplePartial
{
}

If you want to specify proxy members to generate, you just need to set [Proxy(Only = true)] and add [ProxyGen] attribute to the members.

[Proxy(Only = true,Static = true,Abstract = true,Suffix = "Builder")]
public partial class ClassSampleSyncOnly
{
    [ProxyGen(Ignore = false)]
    public DayOfWeek Week { get; set; }

    [ProxyGen(Ignore = false)] private DayOfWeek PrivateWeek;

    [ProxyGen(Ignore = false)] public event Action EventAction;
    [ProxyGen(Ignore = false)] public event EventHandler Event;
   
    [ProxyGen(Ignore = false)]
    public static Task StaticTaskAsync()
    {
        return Task.CompletedTask;
    }
}

If you want to ignore generate proxy members, you just need to add [ProxyGen(Ignore=true)] attribute to the members.

[Proxy]
public partial class ClassSampleSyncOnly
{
    
    [ProxyGen(Ignore = true)] 
    public event Action EventAction;
    
    [ProxyGen(Ignore = true)]
    public static Task StaticTaskIgnoreAsync()
    {
        return Task.CompletedTask;
    }
}

If you want to specify an identifier with generated a proxy object, you just need to add [Proxy(Identifier = "InterfaceIdentity")] attribute to that object.

[Proxy(Sealed = true, Identifier = "InterfaceIdentity")]
public partial interface InterfaceSample
{
    Task AwaitAsync(int index, string name, Cts token);
}

If you want to specify an suffix with generated a proxy object, you just need to add [Proxy(Suffix = "Builder")] attribute to that object.

[Proxy(Only = true,Static = true,Abstract = true,Suffix = "Builder")]
public partial class ClassSampleSyncOnly
{
}

If you want to specify interface with generated a proxy object, you just need to add [Proxy(Interfaces = new []{nameof(IAsync)})] attribute to that object.

public interface IAsync {}

[Proxy(Interfaces = new []{nameof(IAsync)})]
public partial class ClassSamplePartial
{
}

References

License

MIT

There are no supported framework assets in this package.

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
2024.101.8-rc175707 161 1/8/2024
2023.412.21 251 12/21/2023
2023.412.21-rc202346 145 12/21/2023
2023.412.17 164 12/17/2023
2023.412.17-rc170547 158 12/17/2023
2023.412.12 139 12/12/2023
2023.410.20.1 228 10/20/2023
2023.410.20 230 10/20/2023
2023.410.19-pre1 225 10/18/2023
2023.410.18 254 10/18/2023