StrongCX.SourceGenerators 2.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package StrongCX.SourceGenerators --version 2.0.5
                    
NuGet\Install-Package StrongCX.SourceGenerators -Version 2.0.5
                    
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="StrongCX.SourceGenerators" Version="2.0.5">
  <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="StrongCX.SourceGenerators" Version="2.0.5" />
                    
Directory.Packages.props
<PackageReference Include="StrongCX.SourceGenerators">
  <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 StrongCX.SourceGenerators --version 2.0.5
                    
#r "nuget: StrongCX.SourceGenerators, 2.0.5"
                    
#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 StrongCX.SourceGenerators@2.0.5
                    
#: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=StrongCX.SourceGenerators&version=2.0.5
                    
Install as a Cake Addin
#tool nuget:?package=StrongCX.SourceGenerators&version=2.0.5
                    
Install as a Cake Tool

StrongCX.SourceGenerators

OrnamentERPNew 的源生成器

  1. BackupEntityAttribute 备份实体生成器

BackupEntityAttribute

备份实体特性,用于自动生成要备份的实体类的备份类。

  1. 在实体类上添加 BackupEntityAttribute 特性。
/// <summary>
/// 原始实体
/// </summary>
[Table("Base_Original_Entity")]
[BackupEntity(Suffix = "Backup")]
public partial class OriginalEntity : EntityBase
{
    /// <summary>
    /// Id
    /// </summary>
    [Key]
    [Column(TypeName = "bigint")]
    public long Id { get; set; }

    /// <summary>
    /// 编码
    /// </summary>
    [Column(TypeName = "nvarchar")]
    [MaxLength(64)]
    public string Code { get; set; }

    /// <summary>
    /// 分类Id
    /// </summary>
    [Column(TypeName = "bigint")]
    public long ClassId { get; set; }

}
  1. 生成器将会生成以下实体
/// <summary>
/// 原始实体
/// </summary>
[TableAttribute("Base_Original_Entity_Backup")]
public partial class OriginalEntityBackup : EntityBase
{
    /// <summary>
    /// Id
    /// </summary>
    [Key]
    [Column(TypeName = "bigint")]
    public long Id { get; set; }

    /// <summary>
    /// 编码
    /// </summary>
    [Column(TypeName = "nvarchar")]
    [MaxLength(64)]
    public string Code { get; set; }

    /// <summary>
    /// 分类Id
    /// </summary>
    [Column(TypeName = "bigint")]
    public long ClassId { get; set; }
}

Attribute

在项目中定义需要使用的特性

using System;

namespace StrongCX.Attributes
{
    /// <summary>
    /// 标识一个实体类,并为其生成备份实体类。
    /// </summary>
    [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
    public sealed class BackupEntityAttribute : Attribute
    {
        /// <summary>
        /// 备份类的后缀名,默认为 "Backup"。
        /// </summary>
        public string Suffix { get; set; } = "Backup";
        /// <summary>
        /// 备份类是否继承自 IHistoryEntityBase<T>,默认为 "false"。
        /// </summary>
        public bool UseInterface { get; set; } = false;
    }
}
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
2.0.6 126 1/21/2026
2.0.6-alpha1 110 1/21/2026
2.0.5 590 7/22/2025
2.0.4 684 7/1/2025 2.0.4 is deprecated because it has critical bugs.

移除第三方依赖