Hsu.Sg.Proxy
2023.412.21
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
<PackageReference Include="Hsu.Sg.Proxy" Version="2023.412.21"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Hsu.Sg.Proxy --version 2023.412.21
#r "nuget: Hsu.Sg.Proxy, 2023.412.21"
// 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 | ||
Hsu.Sg.Proxy | 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
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Nito.AsyncEx.Context (>= 5.1.2)
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 |