Skip to content

Latest commit

 

History

History
224 lines (161 loc) · 9.76 KB

File metadata and controls

224 lines (161 loc) · 9.76 KB

Sphere10 Framework: Complete Architecture & Overview

Table of Contents

  1. What is Sphere10 Framework
  2. Core Design Principles
  3. Architecture Overview
  4. Key Capabilities
  5. Framework Domains
  6. Related Documentation

What is Sphere10 Framework

Sphere10 Framework is a mature, production-ready .NET 8.0+ comprehensive framework designed for building full-stack applications across desktop, mobile, and web platforms. Originally architected for blockchain systems and P2P applications, Sphere10 Framework has evolved into a general-purpose framework offering robust abstractions, advanced data structures, cryptographic primitives, and enterprise-grade utilities for high-performance .NET development.

Vision & Goals

Vision: Provide developers with a unified, extensible foundation for building sophisticated applications with minimal boilerplate, maximum code reuse, and built-in support for scalability, security, and cross-platform deployment.

Core Goals:

  • Unified Architecture: Consistent patterns across all platforms and application types
  • Enterprise Quality: Production-ready, well-tested, thoroughly documented code
  • Extensibility: Plugin architecture and extension points throughout all layers
  • Performance: Optimized algorithms, memory efficiency, and concurrent execution
  • Developer Experience: Intuitive APIs, comprehensive documentation, and clear patterns
  • Cross-Platform: Single codebase targeting Windows, macOS, iOS, Android, and .NET 8.0+

Core Design Principles

1. Zero Blockchain Dependencies

Principle: Core framework code has zero dependencies on blockchain or DApp functionality, making it suitable for any .NET project (desktop, web, mobile, server, embedded).

Benefit: Developers can use powerful utilities (cryptography, data structures, networking, serialization) without bringing in specialized blockchain libraries.

2. Tools.* Namespace Discovery Pattern

Pattern: All utility methods are discoverable through the Tools.* namespace, providing global IntelliSense access to 40+ tool classes.

Example:

byte[] hash = Tools.Crypto.SHA256(data);
string sanitized = Tools.Text.RemoveWhitespace(input);
var connection = Tools.Sqlite.Create(connectionString);
bool running = Tools.WinTool.IsServiceRunning("MyService");

3. Layered Architecture

The framework follows a 5-layer architectural model:

  1. System Tier — Core utilities, collections, cryptography, serialization, networking (Sphere10.Framework)
  2. Processing Tier — Application lifecycle, DI, configuration, business logic (Sphere10.Framework.Application)
  3. Data Tier — Database abstraction, multi-DB support, ORM integration (Sphere10.Framework.Data.*)
  4. Presentation Tier — UI components, Windows Forms, Blazor, drawing (Sphere10.Framework.Windows.Forms, Sphere10.Framework.Web.AspNetCore, Sphere10.Framework.Drawing)
  5. Specialization Tier — Optional specializations (e.g., consensus) (Sphere10.Framework.Consensus)

4. Plugin Architecture

The framework supports dynamic plugin loading and lifecycle management for extensible applications, particularly useful for blockchain consensus rules and DApp components.

5. Data Abstraction

All database access goes through the Sphere10.Framework.Data abstraction layer, providing:

  • Multi-database support (SQL Server, SQLite, Firebird, NHibernate)
  • Consistent query building API
  • Automatic connection pooling
  • Transaction management

Architecture Overview

Project Organization (45+ Projects)

Sphere10.Framework/
├── Core Utilities       (Sphere10.Framework)
├── Application Layer    (Sphere10.Framework.Application)
├── Cryptography         (Sphere10.Framework.CryptoEx)
├── Communications       (Sphere10.Framework.Communications)
├── Data Access          (Sphere10.Framework.Data.*)
├── Desktop UI           (Sphere10.Framework.Windows.*)
├── Web/Blazor           (Sphere10.Framework.Web.AspNetCore)
├── Graphics             (Sphere10.Framework.Drawing)
├── Cross-Platform       (Sphere10.Framework.iOS/Android/macOS)
└── Consensus            (Sphere10.Framework.Consensus)

Dependency Graph (Simplified)

Sphere10.Framework (Core)
├── HashLib4CSharp (Cryptography)
├── Sphere10.Framework.Communications (Networking)
└── Sphere10.Framework.CryptoEx (Advanced Crypto)

Sphere10.Framework.Data (Database Abstraction)
├── Sphere10.Framework.Data.Sqlite
├── Sphere10.Framework.Data.MSSQL
├── Sphere10.Framework.Data.Firebird
└── Sphere10.Framework.Data.NHibernate

Presentation Layers
├── Sphere10.Framework.Windows.Forms (+ Data variants)
├── Sphere10.Framework.Web.AspNetCore
└── Sphere10.Framework.Drawing

Consensus Framework (Optional Specialization)
└── Sphere10.Framework.Consensus

Key Capabilities

Core Framework Features

Category Capabilities
Collections B-trees, merkle trees, paged collections, transactional collections, observable collections, 50+ specialized types
Cryptography SHA/Blake2/MD5 (HashLib4CSharp), ECDSA, post-quantum algorithms, key derivation, digital signatures
Serialization Binary, JSON, XML, streaming formats with automatic change tracking
Data Access Multi-database ADO.NET abstraction, SQL query building, CSV support, connection pooling
Networking TCP, UDP, WebSockets, JSON-RPC, anonymous pipes, P2P abstractions
UI Components Windows Forms data binding, Blazor components, cross-platform drawing
Caching LRU/LFU/FIFO strategies, batch caching, session management
Utilities Logging, scheduling, threading, reflection, configuration, environment introspection
Testing NUnit integration, 2000+ comprehensive tests, test utilities

Platform Support

  • Windows: Full .NET Framework + modern .NET support
  • Web: ASP.NET Core middleware, Blazor components, WebAssembly hosting
  • Mobile: Xamarin.iOS, Xamarin.Android, MAUI integration
  • macOS: Xamarin.macOS, native integration
  • Runtime: .NET 8.0+ (cross-platform), .NET Framework 4.8+

Framework Domains

The core framework provides 40+ domains of specialized functionality:

System Tier Domains (Sphere10.Framework)

Domain Purpose
Collections Advanced collection types (merkle trees, paged data, transactional, observable)
Cryptography Hashing, signatures, encryption, key derivation, post-quantum
Encoding Hex, Base64, endian conversion
Extensions 200+ extension methods for .NET types
IO Endian-aware file I/O, stream tools, temporary file management
Memory Buffer operations, memory allocation, unit conversion
Networking URL, MIME, POP3, P2P abstractions
Objects Clone, compare, merge, introspection tools
Reflection Type activation, member discovery, attribute inspection
Scheduling Background task scheduling with time-based rules
Serialization Object serialization across multiple formats
Streams Bit streams, blocking streams, bounded streams, pipelines
Text Parsers, inflectors, regex builders, HTML tools
Threading Multi-threading utilities, synchronization primitives
XML Deep serialization, XPath support

Processing Tier Domains (Sphere10.Framework.Application)

Domain Purpose
Component Registry IoC container, dependency injection
Configuration Settings management, environment-aware config
Plugin System Dynamic plugin loading and lifecycle
Command-Line CLI argument parsing and command execution

Data Tier Domains (Sphere10.Framework.Data.*)

Domain Purpose
Database Abstraction Multi-database support with unified API
Query Building Fluent SQL query construction
Object Spaces Stream-mapped persistent collections
Change Tracking Automatic dirty tracking and merkle updates

Presentation Tier Domains

Domain Purpose
Windows Forms Data binding, validation, component library
Web/Blazor ASP.NET Core middleware, Blazor components
Drawing Cross-platform graphics and image manipulation

Design Patterns

Pattern 1: Dependency Injection

All framework components support constructor-based dependency injection via the built-in TinyIoC container. This enables loose coupling and testability.

Pattern 2: Plugin Architecture

Consensus rules and other components can be dynamically loaded as plugins, allowing applications to evolve without recompilation.

Pattern 3: Stream-Backed Collections

Advanced data structures use stream-mapping to handle large datasets efficiently without loading everything into memory. Perfect for blockchain applications.

Pattern 4: Transactional Collections

Collections support transactional semantics (begin, commit, rollback) for data consistency in multi-user scenarios.

Pattern 5: Tools.* Discovery

All utilities are accessible through Tools.* namespace for maximum IntelliSense discoverability. New projects can extend this pattern by adding their own Tool class.


Related Documentation