XZJ.PropertyInstantStorage 1.0.0

dotnet add package XZJ.PropertyInstantStorage --version 1.0.0
                    
NuGet\Install-Package XZJ.PropertyInstantStorage -Version 1.0.0
                    
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="XZJ.PropertyInstantStorage" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XZJ.PropertyInstantStorage" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="XZJ.PropertyInstantStorage" />
                    
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 XZJ.PropertyInstantStorage --version 1.0.0
                    
#r "nuget: XZJ.PropertyInstantStorage, 1.0.0"
                    
#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 XZJ.PropertyInstantStorage@1.0.0
                    
#: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=XZJ.PropertyInstantStorage&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=XZJ.PropertyInstantStorage&version=1.0.0
                    
Install as a Cake Tool

属性数据即时存储库

当想要某些属性能够保存至本地,并且在应用重启后依然能够保留这些属性的数据时,可以使用属性数据即时存储库。没有Redis的复杂,当然也没有Redis 的强大功能 。开发这个库旨在简单保存、操作、使用。

使用方法

属性数据保存路径默认在应用程序运行目录下的 DataInstanStorage 文件夹下。也可以自定路径,在以下代码中有示例。

    /// <summary>
    /// 需要继承 PropertyInstantStorageBase 类
    /// </summary>
    public class Test:PropertyInstantStorageBase
    {

        private string name;
        /// <summary>
        /// 名称
        /// </summary>
        public string Name
        {
            get => GetStorageProperty(ref name);//程序启动时从文本文件读取值赋值给name
            set =>SetStorageProperty(ref name, value);//值变化时把值存储到文本文件
        }
        /// <summary>
        /// 值集合
        /// </summary>
        [PropertyInstantStorage]
        public List<string> Values { get; set; } = new List<string>();

        public void Excute()
        {
           //程序启动时启动服务加载文本文件数据
            PropertyInstantStorageService propertyInstantStorageService = new PropertyInstantStorageService();
            //自定义存储路径
            propertyInstantStorageService.SetBasePath("E:\\");
            propertyInstantStorageService.Start();
            //赋值的同时把值存储到文本文件
            Name = "测试名称";
            Values.Add("江山代有人才出");
            Values.Add("桃花依旧笑春风");
            //手动设置集合值到文本文件并且取了个名字 TestCollection,当然也可以取 Values这个名字,但一定要有名字区别其它集合
            Values.SetStorage("TestCollection");
        }
    }
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 is compatible.  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. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in 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
1.0.0 222 12/4/2025