Sparkdo.Features
1.0.2
dotnet add package Sparkdo.Features --version 1.0.2
NuGet\Install-Package Sparkdo.Features -Version 1.0.2
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.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sparkdo.Features" Version="1.0.2" />
<PackageReference Include="Sparkdo.Features" />
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.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Sparkdo.Features, 1.0.2"
#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.2
#: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.2
#tool nuget:?package=Sparkdo.Features&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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
功能模块配置类,负责注册功能系统相关服务:
- 注册功能检查器、定义管理器等核心服务
- 配置功能值提供程序
- 集成本地化资源
扩展性
该库提供了完整的功能管理系统,可以通过以下方式扩展:
- 实现自定义的
IFeatureValueProvider来提供功能值 - 实现自定义的
IFeatureStore来持久化功能值 - 实现自定义的
IFeatureDefinitionProvider来动态提供功能定义 - 通过
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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- JetBrains.Annotations (>= 2025.2.4)
- Microsoft.Extensions.Configuration (>= 10.0.5)
- Microsoft.Extensions.Configuration.CommandLine (>= 10.0.5)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 10.0.5)
- Microsoft.Extensions.Configuration.FileExtensions (>= 10.0.5)
- Microsoft.Extensions.Configuration.Json (>= 10.0.5)
- Microsoft.Extensions.Configuration.UserSecrets (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.DependencyModel (>= 10.0.5)
- Microsoft.Extensions.FileProviders.Composite (>= 10.0.5)
- Microsoft.Extensions.FileProviders.Embedded (>= 10.0.5)
- Microsoft.Extensions.FileProviders.Physical (>= 10.0.5)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Localization (>= 10.0.5)
- Microsoft.Extensions.Logging (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Options (>= 10.0.5)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.5)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.5)
- Nito.AsyncEx.Context (>= 5.1.2)
- Sparkdo.Localization (>= 1.0.2)
- Sparkdo.MultiTenancy.Abstractions (>= 1.0.2)
- Sparkdo.Security (>= 1.0.2)
- Sparkdo.StateChecking (>= 1.0.2)
- Sparkdo.Validation (>= 1.0.2)
- System.Linq.Dynamic.Core (>= 1.7.1)
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 | 175 | 4/27/2026 |
| 1.0.2-preview.5 | 67 | 4/15/2026 |
| 1.0.2-preview.4 | 80 | 2/8/2026 |
| 1.0.2-preview.3 | 78 | 2/1/2026 |
| 1.0.2-preview.2 | 84 | 1/31/2026 |
| 1.0.2-preview.1 | 183 | 12/4/2025 |
| 1.0.1 | 586 | 11/27/2025 |
| 1.0.0 | 579 | 11/25/2025 |
| 1.0.0-preview.5 | 137 | 10/24/2025 |