Sparkdo.Validation.Abstractions 1.0.1

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

Sparkdo.Validation.Abstractions

Sparkdo 验证抽象库,提供验证相关的基础接口和异常类型定义。

功能特性

  • 验证器接口定义(IObjectValidator 等)
  • 验证结果接口定义(IValidationResult 等)
  • 验证异常类型(SparkdoValidationException)
  • 验证相关属性定义(ValidationEnableAttribute 等)

安装

<PackageReference Include="Sparkdo.Validation.Abstractions" Version="x.x.x" />

核心组件

IObjectValidator

对象验证器接口,提供对象验证功能:

  • ValidateAsync(): 验证对象,如果验证失败则抛出异常
  • GetErrorsAsync(): 获取对象的验证错误列表

SparkdoValidationException

验证异常类型,用于表示验证失败的情况:

  • 包含详细的验证错误信息列表
  • 支持日志级别配置
  • 提供友好的错误信息输出

其他接口

  • IValidationResult: 验证结果接口
  • IWithValidationErrors: 带验证错误信息的接口
  • IValidationEnabled: 启用验证的标记接口
  • IMethodInvocationValidator: 方法调用验证器接口
  • IObjectValidationContributor: 对象验证贡献者接口

扩展性

该库提供了验证功能的基础抽象,可以通过实现这些接口来创建具体的验证实现。

代码结构说明

本项目包含以下主要组件:

验证接口

  • IObjectValidator: 对象验证器接口
  • IValidationResult: 验证结果接口
  • IWithValidationErrors: 带验证错误信息的接口
  • IValidationEnabled: 启用验证的标记接口
  • IMethodInvocationValidator: 方法调用验证器接口
  • IObjectValidationContributor: 对象验证贡献者接口

验证异常

  • SparkdoValidationException: 验证异常类型

验证属性

  • ValidationEnableAttribute: 启用验证的属性
  • ValidationDisableAttribute: 禁用验证的属性
  • DynamicMaxLengthAttribute: 动态最大长度验证属性
  • DynamicRangeAttribute: 动态范围验证属性
  • DynamicStringLengthAttribute: 动态字符串长度验证属性

上下文类

  • ObjectValidationContext: 对象验证上下文
  • MethodInvocationValidationContext: 方法调用验证上下文

扩展方法

  • HasValidationErrorsExtensions: 验证错误扩展方法

所有公共接口和类都添加了详细的 XML 文档注释,便于开发者理解和使用。

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Sparkdo.Validation.Abstractions:

Package Downloads
Sparkdo.ObjectExtending

Sparkdo 对象扩展模块,提供对象属性扩展功能

Sparkdo.Validation

Sparkdo 验证库,提供基于数据注解的对象验证功能实现

Sparkdo.ExceptionHandling

Sparkdo 异常处理库,提供统一的异常处理机制和错误信息转换功能

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2-preview.1 171 12/4/2025
1.0.1 2,579 11/27/2025
1.0.0 2,535 11/25/2025
1.0.0-preview.5 100 10/24/2025