StrongCX.Analyzers
2.0.6
dotnet add package StrongCX.Analyzers --version 2.0.6
NuGet\Install-Package StrongCX.Analyzers -Version 2.0.6
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.Analyzers" Version="2.0.6"> <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.Analyzers" Version="2.0.6" />
<PackageReference Include="StrongCX.Analyzers"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
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.Analyzers --version 2.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: StrongCX.Analyzers, 2.0.6"
#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.Analyzers@2.0.6
#: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.Analyzers&version=2.0.6
#tool nuget:?package=StrongCX.Analyzers&version=2.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
StrongCX.Analyzers
OrnamentERPNew 的代码质量分析器
- 最低要求 Visual Studio 2022 >= 17.10
- 支持
传统项目和SDK样式项目
- BackupModelAnalyzer 备份表分析器
- ReadOnlyDatabaseAnalyzer 只读库分析器
- Attribute 自定义特性
BackupModelAnalyzers
备份表分析器,用于分析指定表的修改情况,若没有同步修改备份表,则抛出异常,并给出修补方式。
- 添加项目文件
Analyzers/BackupModelAnalyzer.json
{
// 是否启用此分析器
"Enable": true,
// 需要检查的表
"BackupTables": [
{
// 原始表名
"OriginalName": "dbo.Sys_HasBackupTest",
// 备份表名
"BackupName": "dbo.Sys_HasBackupTest_History",
// 开始分析的时间
"StartTime": 202501131049021
}
]
}
- 修改项目配置
<ItemGroup>
<AdditionalFiles Include="Analyzers/BackupModelAnalyzer.json" />
</ItemGroup>
- 可以使用
IgnoreBackupModelAnalyzerAttribute来忽略备份表分析器的检查。
namespace StrongCX.DataAccess.Migrations
{
using System;
using System.Data.Entity.Migrations;
[StrongCX.Analyzers.Attributes.IgnoreBackupModelAnalyzer]
public partial class Update379 : DbMigration
{
public override void Up()
{
AddColumn("dbo.Sys_HasBackupTest", "CustomColumn", c => c.String());
//AddColumn("Sys_HasBackupTest_History", "CustomColumn", c => c.String());
}
public override void Down()
{
DropColumn("dbo.Sys_HasBackupTest", "CustomColumn");
}
}
}
ReadOnlyDatabaseAnalyzer
只读数据库分析器,用于分析指定的只读数据库中是否添加特定SQL语句,没有添加则抛出异常,并给出修补方式。
- 添加项目文件
Analyzers/ReadOnlyDatabaseAnalyzer.json
{
// 是否启用此分析器
"Enable": true,
// 需要添加的语句
"ReadDbSQL": "Sql(ReadDBPublication.TransactionSQL);",
// 开始分析的时间
"StartTime": 202501131049021
}
- 修改项目配置
<ItemGroup>
<AdditionalFiles Include="Analyzers/ReadOnlyDatabaseAnalyzer.json" />
</ItemGroup>
- 可以使用
IgnoreReadOnlyDatabaseAnalyzerAttribute来忽略只读数据库分析器的检查。
namespace StrongCX.DataAccess.Migrations
{
using System;
using System.Data.Entity.Migrations;
[StrongCX.Analyzers.Attributes.IgnoreReadOnlyDatabaseAnalyzer]
public partial class Update379 : DbMigration
{
public override void Up()
{
// Sql(ReadDBPublication.TransactionSQL);
}
public override void Down()
{
}
}
}
Attribute
在项目中定义需要使用的特性,确保命名空间为
StrongCX.Attributes
#pragma warning disable IDE0130
namespace StrongCX.Attributes
{
/// <summary>
/// 忽略备份表分析。
/// </summary>
[System.AttributeUsage(System.AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class IgnoreBackupModelAnalyzerAttribute : System.Attribute { }
/// <summary>
/// 忽略只读库分析。
/// </summary>
[System.AttributeUsage(System.AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class IgnoreReadOnlyDatabaseAnalyzerAttribute : System.Attribute { }
}
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 | 155 | 1/21/2026 |
降低 Roslyn 依赖版本,最低支持 Visual Studio 2022 17.10