Hsu.Sg.FluentMember 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.FluentMember --version 2023.412.21
                    
NuGet\Install-Package Hsu.Sg.FluentMember -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.FluentMember" 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.
<PackageVersion Include="Hsu.Sg.FluentMember" Version="2023.412.21" />
                    
Directory.Packages.props
<PackageReference Include="Hsu.Sg.FluentMember">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Hsu.Sg.FluentMember --version 2023.412.21
                    
#r "nuget: Hsu.Sg.FluentMember, 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.
#:package Hsu.Sg.FluentMember@2023.412.21
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Hsu.Sg.FluentMember&version=2023.412.21
                    
Install as a Cake Addin
#tool nuget:?package=Hsu.Sg.FluentMember&version=2023.412.21
                    
Install as a Cake Tool

Hsu.Sg.FluentMember

Generate a fluent method for fields and properties from a struct or class.

Package Version

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

Usages

Install

  • Hsu.Sg.FluentMember

You can install the package from nuget.

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

Attributes

Add the FluentMember attribute and partial keyword to the class or struct.

[FluentMember]
public partial class ClassSamplePartial
{
}

If you want to specify fluent members to generate, you just need to set [FluentMember(Only = true)] and add [FluentMemberGen] attribute to the members.

[FluentMember(Only = true)]
public partial class ClassSampleSyncOnly
{
    [FluentMemberGen(Ignore = true)]
    public DayOfWeek Week { get; set; }

    [FluentMemberGen(Ignore = true)] 
    private DayOfWeek PrivateWeek;

    [FluentMemberGen(Ignore = true)] 
    public event Action EventAction;
}

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

[FluentMember]
public partial class ClassSampleSyncOnly
{
    [FluentMemberGen(Ignore = true)] 
    public event Action EventAction;
}

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

[FluentMember(Private = true)]
public partial class TestEventClass
{
    [FluentMemberGen(Identifier = "UseOnEnterWithArgs")] 
    public event EventHandler<EventArgs> OnEnterWithArgs;
}

If you want to specify an prefix with generated a fluent object, you just need to add [FluentMember(Prefix = "With")] attribute to that object or add [FluentMemberGen(Prefix = "Add")] attribute to that member.

[FluentMember(Internal = true,Private = true,Prefix = "With")]
public partial class TestFieldClass
{
    [FluentMemberGen(Prefix = "Add",Modifier = Accessibility.Internal)] 
    protected event Action<object> onResult;
}

If you want to specify an accessible with generated a fluent object, you just need to add [FluentMemberGen(Modifier = Accessibility.Internal)] attribute to that member.

[FluentMember]
public partial class TestFieldClass
{
    [FluentMemberGen(Modifier = Accessibility.Internal)]
    private event Action<object> onResult;
}

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 193 1/8/2024
2023.412.21 276 12/21/2023
2023.412.21-rc202346 137 12/21/2023
2023.412.17 196 12/17/2023
2023.412.17-rc170547 179 12/17/2023
2023.412.13 232 12/13/2023
2023.412.12.1 154 12/12/2023
2023.412.12 157 12/12/2023