FractalDataWorks.Tools
0.1.26-alpha-gf64f8fdedf
dotnet add package FractalDataWorks.Tools --version 0.1.26-alpha-gf64f8fdedf
NuGet\Install-Package FractalDataWorks.Tools -Version 0.1.26-alpha-gf64f8fdedf
<PackageReference Include="FractalDataWorks.Tools" Version="0.1.26-alpha-gf64f8fdedf" />
<PackageVersion Include="FractalDataWorks.Tools" Version="0.1.26-alpha-gf64f8fdedf" />
<PackageReference Include="FractalDataWorks.Tools" />
paket add FractalDataWorks.Tools --version 0.1.26-alpha-gf64f8fdedf
#r "nuget: FractalDataWorks.Tools, 0.1.26-alpha-gf64f8fdedf"
#:package FractalDataWorks.Tools@0.1.26-alpha-gf64f8fdedf
#addin nuget:?package=FractalDataWorks.Tools&version=0.1.26-alpha-gf64f8fdedf&prerelease
#tool nuget:?package=FractalDataWorks.Tools&version=0.1.26-alpha-gf64f8fdedf&prerelease
FractalDataWorks Developer Kit
🚧 IN PROGRESS - Enhanced Enum Type Factories implementation in progress
A comprehensive .NET library framework providing foundational abstractions and implementations for building scalable, maintainable enterprise applications.
Overview
The FractalDataWorks Developer Kit is a layered architecture framework that provides:
- Core abstractions for services, configuration, validation, and results
- Service patterns with built-in validation, Serilog structured logging, and error handling
- Configuration management with validation and registry patterns
- Enhanced messaging using the EnhancedEnums pattern for type-safe, maintainable messages
- Extensible architecture supporting dependency injection, data access, hosting, and tools
Architecture
The framework follows a progressive layered architecture with clear separation between core abstractions and implementations. All core interfaces reside in Layer 0.5, while implementations are provided in Layer 1 packages.
Key Architectural Patterns
- Universal Data Service: A single data service handles all data operations through a command pattern with provider-specific implementations
- External Connections as Boundaries: External connections represent the boundary between the framework and external systems
- Command Transformation: Universal commands (LINQ-like) are transformed to provider-specific commands via command builders
- Service Factory Pattern: Services use factories to obtain and manage connections internally
Layer 0.5 - Core Foundation (No Dependencies)
- FractalDataWorks.net - Core abstractions and base types (targets netstandard2.0 for maximum compatibility)
IFdwService
- Base service abstractionIFdwConfiguration
- Configuration abstractionIFdwResult
&FdwResult<T>
- Consistent result patternServiceMessage
- Enhanced enum-based messaging systemIFdwValidator<T>
- Validation abstractionsIServiceFactory
- Service factory abstractionIConfigurationRegistry
- Configuration registry abstractionIExternalConnection
- External connection boundary interfaceIFdwConnection
- Framework connection wrapperIDataConnection
- Universal data service abstractionIFdwDataCommand
- Universal data command interface (Query/Insert/Update/Upsert/Delete)
Layer 1 - Domain-Specific Implementations
FractalDataWorks.Services - Service patterns and base implementations
ServiceBase<TConfiguration, TCommand>
- Base service with validation and Serilog structured loggingDataConnection<TDataCommand, TConnection>
- Universal data service implementation- Built-in command validation and error handling
- Comprehensive logging with ServiceBaseLog using source generators and Serilog destructuring
FractalDataWorks.Configuration - Configuration providers and patterns
ConfigurationBase<T>
- Self-validating configuration base classConfigurationProviderBase
- Provider pattern implementationConfigurationSourceBase
- Configuration source abstractions
FractalDataWorks.Connections - External connection implementations
ExternalConnectionBase<TCommandBuilder, TCommand, TConnection, TFactory, TConfig>
- Base for provider-specific connectionsExternalConnectionProvider
- Selects appropriate connection factory- Provider implementations (e.g.,
MsSqlConnection
,PostgresConnection
) - Command builders that transform universal commands to provider-specific commands
FractalDataWorks.DependencyInjection - DI container abstractions
- Container-agnostic dependency injection patterns
- Service registration extensions
FractalDataWorks.Tools - Common utilities and helpers
- Extension methods and utility classes
- Common helper functions
FractalDataWorks.Hosts - Web and worker host abstractions
- Host service abstractions
- Background service patterns
FractalDataWorks.Data - Entity base classes and data patterns
- Entity base classes with audit fields
- Soft delete and versioning support
- Entity validation patterns
Package Documentation
Each package has its own detailed README with usage examples and API documentation:
Core Foundation
- FractalDataWorks.net - Core abstractions and base types
Layer 1 Packages
- FractalDataWorks.Services - Service patterns and base implementations
- FractalDataWorks.Configuration - Configuration management system
- FractalDataWorks.Connections - Connection abstractions and base implementations
- FractalDataWorks.Data - Data access abstractions and entity base classes
- FractalDataWorks.DependencyInjection - DI container abstractions (planning phase)
- FractalDataWorks.Hosts - Host service abstractions (planning phase)
- FractalDataWorks.Tools - Common utilities and helpers (planning phase)
Git Workflow
This repository follows a git-flow branching strategy:
- master - Production-ready releases only
- develop - Main development branch
- feature/ - Feature branches
- beta/ - Beta release branches
- release/ - Release candidate branches
- experimental/ - Experimental features
Setting up the Development Branch
After cloning, create the develop branch from master:
git checkout -b develop
git push -u origin develop
Creating Feature Branches
Always branch from develop:
git checkout develop
git pull origin develop
git checkout -b feature/your-feature-name
Building and Testing
Prerequisites
- .NET 10.0 Preview SDK
- Visual Studio 2022 Preview or VS Code
Build Commands
# Restore packages
dotnet restore
# Build solution
dotnet build
# Run tests
dotnet test
# Pack NuGet packages
dotnet pack
Configuration-Specific Builds
# Debug build (default)
dotnet build
# Alpha build
dotnet build -c Alpha
# Beta build
dotnet build -c Beta
# Release build
dotnet build -c Release
Package Dependencies
Each Layer 1 package depends on FractalDataWorks.net. Additional dependencies:
- FractalDataWorks.DependencyInjection also depends on FractalDataWorks.Configuration
- FractalDataWorks.Hosts also depends on FractalDataWorks.Services
Testing
All projects use xUnit.v3 for testing. Test projects follow the naming convention:
FractalDataWorks.[Package].Tests
Run tests with:
dotnet test
CI/CD
This repository includes both Azure Pipelines and GitHub Actions workflows for CI/CD.
Azure Pipelines
- Configuration:
azure-pipelines.yml
- Publishes to Azure Artifacts feed:
dotnet-packages
GitHub Actions
- Configuration:
.github/workflows/ci.yml
- Publishes to GitHub Packages and optionally Azure Artifacts
Contributing
- Create a feature branch from develop
- Make your changes
- Ensure all tests pass
- Submit a pull request to develop
Key Features
Service Pattern
public class MyService : ServiceBase<MyConfiguration, MyCommand>
{
public MyService(ILogger<MyService> logger, IConfigurationRegistry<MyConfiguration> configs)
: base(logger, configs)
{
}
protected override async Task<FdwResult<TResult>> ExecuteCore<TResult>(MyCommand command)
{
// Implementation with automatic validation and error handling
}
}
Configuration Management
public class MyConfiguration : ConfigurationBase<MyConfiguration>
{
public string ConnectionString { get; set; }
public int Timeout { get; set; }
protected override FluentValidation.Results.ValidationResult ValidateCore()
{
var validator = new MyConfigurationValidator();
return validator.Validate(this);
}
}
Enhanced Messaging
// Type-safe, discoverable service messages with Serilog structured logging
_logger.LogError("Invalid configuration: {Error}", ServiceMessages.InvalidConfiguration.Format("Missing connection string"));
_logger.LogInformation("Service started: {ServiceName}", ServiceName);
// Enhanced structured logging with Serilog destructuring
_logger.LogError("Connection failed after {Retries} attempts: {@Error}",
retries, new { Message = errorMessage, Timestamp = DateTime.UtcNow });
// Use ServiceBaseLog for comprehensive structured logging
ServiceBaseLog.CommandExecutedWithContext(_logger, command);
ServiceBaseLog.PerformanceMetrics(_logger, new PerformanceMetrics(150.5, 1000, "BatchProcess"));
Result Pattern
// Consistent error handling across all services
var result = await service.Execute<Customer>(command);
if (result.IsSuccess)
{
return Ok(result.Value);
}
else
{
return BadRequest(result.Error);
}
Universal Data Service Pattern
// Universal data service that works with any data source
public class DataConnection<TDataCommand, TConnection> : ServiceBase<TDataCommand>
where TDataCommand : IFdwDataCommand
{
private readonly IExternalConnectionProvider _connectionProvider;
protected override async Task<FdwResult<TResult>> ExecuteCore<TResult>(TDataCommand command)
{
// Provider selects appropriate connection based on configuration
var connection = await _connectionProvider.GetConnection(command.ConnectionId);
return await connection.Execute<TResult>(command);
}
}
// SQL Server provider implementation
public class MsSqlConnection : ExternalConnectionBase<SqlCommandBuilder, SqlCommand, SqlConnection, SqlConnectionFactory, SqlConfiguration>
{
protected override SqlCommand BuildCommand(IFdwDataCommand dataCommand)
{
// SqlCommandBuilder transforms universal command to SQL
return CommandBuilder.Build(dataCommand);
}
}
Code Quality
The framework enforces code quality through:
- Analyzers: StyleCop, AsyncFixer, Meziantou.Analyzer, Roslynator
- Threading Analysis: Microsoft.VisualStudio.Threading.Analyzers
- XML Documentation: Required for all public/protected members
- Testing: xUnit v3 with parallel execution
- Coverage: Coverlet integration for code coverage
- Build Configurations: Progressive quality gates from Debug to Release
Enhanced Enum Type Factories
🚧 IN PROGRESS - New pattern for type registration using Enhanced Enums
The Enhanced Enum Type Factories pattern provides compile-time safe, automatically registered factory types for services, connections, and tools. This pattern leverages source generators to create strongly-typed collections with full IntelliSense support.
Key Benefits
- Compile-time Safety: All types are verified at compile time
- IntelliSense Support: Full IDE support for generated collections (ServiceTypes., ConnectionTypes., ToolTypes.*)
- Automatic DI Registration: Types are automatically registered with dependency injection
- Factory Pattern: Each type acts as a factory for creating instances
- Discoverability: Easy discovery of available types through generated static collections
Quick Example
// Define a service type
[EnumOption(1, "EmailNotification", "Email notification service")]
public class EmailNotificationServiceType : ServiceTypeBase<INotificationService, EmailConfiguration>
{
public override object Create(EmailConfiguration configuration)
{
return new EmailNotificationService(configuration);
}
}
// Use the generated collections
var emailService = ServiceTypes.EmailNotification.Instance;
var allServices = ServiceTypes.All;
var service = ServiceTypes.GetByName("EmailNotification");
// Automatic DI registration
services.AddServiceTypes(Assembly.GetExecutingAssembly());
For detailed documentation, see Enhanced Enum Type Factories Documentation.
Quality Gate Configurations
Configuration | Warnings as Errors | Analyzers | Code Style | Use Case |
---|---|---|---|---|
Debug | No | Disabled | No | Fast development |
Experimental | No | Minimal | No | Early prototyping |
Alpha | No | Minimal | No | Initial testing |
Beta | Yes | Recommended | Yes | Development |
Preview | Yes | Recommended | Yes | Pre-release |
Release | Yes | Recommended | Yes | Production |
License
Apache License 2.0 - see LICENSE file for details.
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. |
-
net10.0
- FractalDataWorks.Messages (>= 0.1.4-alpha-gbae2e75cc2)
- FractalDataWorks.net (>= 0.1.26-alpha-gf64f8fdedf)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0-preview.6.25358.103)
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 |
---|---|---|
0.1.26-alpha-gf64f8fdedf | 434 | 7/24/2025 |
0.1.25-alpha-g87df5f233b | 439 | 7/23/2025 |
0.1.24-alpha-g91e50a832c | 434 | 7/23/2025 |
0.1.20-alpha-ge511ae2524 | 481 | 7/23/2025 |
0.1.5-alpha-g6de9a08280 | 484 | 7/22/2025 |
0.1.3-alpha-gc2820fa97d | 114 | 7/17/2025 |
0.1.2-alpha-g88aa8ffb70 | 107 | 7/16/2025 |