XFEExtension.NetCore.AutoConfig 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package XFEExtension.NetCore.AutoConfig --version 1.0.3
                    
NuGet\Install-Package XFEExtension.NetCore.AutoConfig -Version 1.0.3
                    
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="XFEExtension.NetCore.AutoConfig" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XFEExtension.NetCore.AutoConfig" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="XFEExtension.NetCore.AutoConfig" />
                    
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 XFEExtension.NetCore.AutoConfig --version 1.0.3
                    
#r "nuget: XFEExtension.NetCore.AutoConfig, 1.0.3"
                    
#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 XFEExtension.NetCore.AutoConfig@1.0.3
                    
#: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=XFEExtension.NetCore.AutoConfig&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=XFEExtension.NetCore.AutoConfig&version=1.0.3
                    
Install as a Cake Tool

XFEExtension.NetCore.AutoConfig

描述

XFEExtension.NetCore.AutoConfig是一个可以自动实现配置文件存储的工具

自动实现配置文件的存储

基础用法
//创建配置文件类
partial class SystemProfile
{
    [ProfileProperty]
    string name;

    [ProfileProperty]
    int _age;
}

//使用配置文件
class Program
{
    static void Main(string[] args)
    {
        SystemProfile.Name = "Test";//在设置值的时候会自动记录并储存
        //SystemProfile.Age = 1;
        Console.WriteLine(SystemProfile.Name);
        Console.WriteLine(SystemProfile.Age);//下次打开程序会自动读取上次程序退出时储存的值
    }
}
设置get和set方法
partial class SystemProfile
{
    [ProfileProperty]
    [ProfilePropertyAddGet(@"Console.WriteLine(""获取了Name"")")]
    [ProfilePropertyAddGet("return Current.name")]
    [ProfilePropertyAddSet(@"Console.WriteLine(""设置了Name"")")]
    [ProfilePropertyAddSet("Current.name = value")]
    string name = string.Empty;

    [ProfileProperty]
    [ProfilePropertyAddGet(@"Console.WriteLine(""获取了Age"")")]
    [ProfilePropertyAddGet("return Current._age")]
    [ProfilePropertyAddSet(@"Console.WriteLine(""设置了Age"")")]
    [ProfilePropertyAddSet("Current._age = value")]
    int _age;
}
设置初始值
partial class SystemProfile
{
    [ProfileProperty]
    string name = "John Wick";

    [ProfileProperty]
    int _age = 59;
}
为属性添加注释
partial class SystemProfile
{
    /// <summary>
    /// 名称
    /// 这段注释会自动添加至自动生成的Name属性上
    /// </summary>
    [ProfileProperty]
    string name;

    [ProfileProperty]
    int _age;
}
使用部分方法来设置get和set方法
partial class SystemProfile
{
    [ProfileProperty]
    string name;

    [ProfileProperty]
    int _age;

    static partial void GetNameProperty()
    {
        Console.WriteLine("获取了Name");
    }

    static partial void SetNameProperty(string value)
    {
        Console.WriteLine($"设置了Name:从{Name}变为了{value}");
    }

    static partial void GetAgeProperty()
    {
        Console.WriteLine("获取了Age");
    }

    static partial void SetAgeProperty(int value)
    {
        Console.WriteLine($"设置了Age:从{Age}变为了{value}");
    }
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on XFEExtension.NetCore.AutoConfig:

Package Downloads
XFEExtension.NetCore.ServerInteractive

Server interaction extension, including user identity verification and querying in conjunction with AutoConfig

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.6 159 9/27/2025
2.0.5 253 12/15/2024
2.0.4 153 12/11/2024
2.0.3 137 12/10/2024
2.0.2 126 12/9/2024
2.0.1 123 12/8/2024
2.0.0 142 12/8/2024
1.3.0 163 11/9/2024
1.2.0 145 11/9/2024
1.1.1 217 7/13/2024
1.1.0 150 7/13/2024
1.0.4 151 6/4/2024
1.0.3 138 6/4/2024
1.0.2 125 6/4/2024
1.0.1 158 6/4/2024
1.0.0 145 6/4/2024

更新引用包为3.0.*版本