Hsu.Sg.FluentMember 2023.412.21-rc202346

This is a prerelease version of Hsu.Sg.FluentMember.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Hsu.Sg.FluentMember --version 2023.412.21-rc202346                
NuGet\Install-Package Hsu.Sg.FluentMember -Version 2023.412.21-rc202346                
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-rc202346">
  <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.FluentMember --version 2023.412.21-rc202346                
#r "nuget: Hsu.Sg.FluentMember, 2023.412.21-rc202346"                
#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.FluentMember as a Cake Addin
#addin nuget:?package=Hsu.Sg.FluentMember&version=2023.412.21-rc202346&prerelease

// Install Hsu.Sg.FluentMember as a Cake Tool
#tool nuget:?package=Hsu.Sg.FluentMember&version=2023.412.21-rc202346&prerelease                

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 172 1/8/2024
2023.412.21 239 12/21/2023
2023.412.21-rc202346 121 12/21/2023
2023.412.17 172 12/17/2023
2023.412.17-rc170547 159 12/17/2023
2023.412.13 210 12/13/2023
2023.412.12.1 136 12/12/2023
2023.412.12 137 12/12/2023