Sparkdo.Features 1.0.1

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

Sparkdo.Features

Sparkdo 功能系统库,提供功能定义、管理、检查和拦截功能。

功能特性

  • 功能定义和分组管理
  • 功能值提供程序(默认值、版本、租户等)
  • 功能检查和验证
  • 方法调用功能拦截
  • 与 Sparkdo 框架无缝集成
  • 支持本地化功能名称和描述

安装

<PackageReference Include="Sparkdo.Features" Version="x.x.x" />

核心组件

FeatureDefinition

功能定义类,用于定义系统中的功能项:

  • Name: 功能唯一名称
  • DisplayName: 功能显示名称(支持本地化)
  • Description: 功能描述(支持本地化)
  • Parent: 父功能(支持功能层次结构)
  • Children: 子功能列表
  • DefaultValue: 功能默认值
  • IsVisibleToClients: 是否对客户端可见
  • IsAvailableToHost: 主机是否可用
  • AllowedProviders: 允许的值提供程序
  • Properties: 自定义属性字典
  • ValueType: 值类型(用于输入验证)

IFeatureChecker

功能检查器接口,用于检查功能是否启用:

  • GetOrNullAsync(): 获取功能值
  • IsEnabledAsync(): 检查功能是否启用

FeatureInterceptor

功能拦截器,用于拦截方法调用并检查所需功能:

  • 自动检查方法所需的功能
  • 与 Sparkdo 代理机制集成

SparkdoFeaturesModule

功能模块配置类,负责注册功能系统相关服务:

  • 注册功能检查器、定义管理器等核心服务
  • 配置功能值提供程序
  • 集成本地化资源

扩展性

该库提供了完整的功能管理系统,可以通过以下方式扩展:

  1. 实现自定义的 IFeatureValueProvider 来提供功能值
  2. 实现自定义的 IFeatureStore 来持久化功能值
  3. 实现自定义的 IFeatureDefinitionProvider 来动态提供功能定义
  4. 通过 SparkdoFeatureOptions 配置功能系统行为

代码结构说明

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

核心定义

  • FeatureDefinition: 功能定义
  • FeatureGroupDefinition: 功能组定义
  • FeatureValue: 功能值

检查器

  • IFeatureChecker: 功能检查器接口
  • DefaultFeatureChecker: 默认功能检查器实现
  • FeatureCheckerExtensions: 功能检查器扩展方法

管理器

  • IFeatureDefinitionManager: 功能定义管理器接口
  • DefaultFeatureDefinitionManager: 默认功能定义管理器实现
  • IFeatureValueProviderManager: 功能值提供程序管理器接口
  • DefaultFeatureValueProviderManager: 默认功能值提供程序管理器实现

值提供程序

  • IFeatureValueProvider: 功能值提供程序接口
  • DefaultValueFeatureValueProvider: 默认值功能值提供程序
  • EditionFeatureValueProvider: 版本功能值提供程序
  • TenantFeatureValueProvider: 租户功能值提供程序

存储

  • IFeatureStore: 功能存储接口
  • NullFeatureStore: 空功能存储实现
  • IStaticFeatureDefinitionStore: 静态功能定义存储接口
  • DefaultStaticFeatureDefinitionStore: 默认静态功能定义存储实现
  • IDynamicFeatureDefinitionStore: 动态功能定义存储接口
  • NullDynamicFeatureDefinitionStore: 空动态功能定义存储实现

拦截器

  • FeatureInterceptor: 功能拦截器
  • FeatureInterceptorRegistrar: 功能拦截器注册器
  • RequiresFeatureAttribute: 需要功能特性
  • IMethodInvocationFeatureCheckerService: 方法调用功能检查服务接口
  • MethodInvocationFeatureCheckerService: 方法调用功能检查服务实现

配置

  • SparkdoFeatureOptions: 功能配置选项
  • SparkdoFeaturesModule: 功能模块配置

资源

  • SparkdoFeatureResource: 功能资源
  • 本地化资源文件(en.json, zh-Hans.json)

所有公共接口和类都添加了详细的 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.Features:

Package Downloads
Sparkdo.Ddd.Application

Sparkdo DDD应用层库,提供DDD应用服务的基础实现

Sparkdo.SettingManagement.Domain.Shared

Sparkdo 设置管理领域共享库,提供设置管理模块的共享资源、常量定义和数据传输对象

Sparkdo.FeatureManagement.Domain

Sparkdo 功能管理领域层,提供功能管理的核心业务逻辑和数据访问接口

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2-preview.1 138 12/4/2025
1.0.1 526 11/27/2025
1.0.0 536 11/25/2025
1.0.0-preview.5 94 10/24/2025