UA.Tenet
4.9.3
dotnet add package UA.Tenet --version 4.9.3
NuGet\Install-Package UA.Tenet -Version 4.9.3
<PackageReference Include="UA.Tenet" Version="4.9.3" />
<PackageVersion Include="UA.Tenet" Version="4.9.3" />
<PackageReference Include="UA.Tenet" />
paket add UA.Tenet --version 4.9.3
#r "nuget: UA.Tenet, 4.9.3"
#:package UA.Tenet@4.9.3
#addin nuget:?package=UA.Tenet&version=4.9.3
#tool nuget:?package=UA.Tenet&version=4.9.3
UA.Tenet
UA.Tenet is the core library of the Tenet Framework, implementing the Tenet methodology and best practices for .NET development. It provides a comprehensive set of design patterns, utilities, and infrastructure components to build maintainable, scalable, and well-structured applications.
Features
π― Design Patterns
- Singleton Pattern: Thread-safe singleton implementation with lazy initialization
- Command Pattern: Encapsulate requests as objects with execute/undo capabilities
- Observer Pattern: Reactive event handling with publisher-subscriber model
- Chain of Responsibility: Process requests through a chain of handlers
- Result Pattern: Type-safe error handling without exceptions
- Request/Response Pattern: Structured communication between components
π§ Agent & Service Infrastructure
- AgentBase: Base class for autonomous agent implementations
- ServiceBase: Foundation for service-oriented architecture
- Dependency Injection Extensions: Automatic registration of services and agents based on attributes
- Lifetime Management: Control over singleton, scoped, and transient lifetimes
π Data Utilities
- JSON: Fast JSON serialization/deserialization helpers
- XML: XML document manipulation utilities
- CSV: CSV parsing and generation
- SQL: SQL query building and parameter handling
- HTTP: Simplified HTTP client operations
π¦ Collections
- CanonicalSet: Set with canonical (by default, same as case-insenstive) key comparison
- Any: Dictionary with case-insenstive key comparison
- TLINQ: Tenet built-in LINQ dynamic operations with queryable extensions
π Smart Enums
- Type-safe enumerations with additional functionality
- JSON serialization support
- Comparison and equality operations
π¬ Messaging & Events
- IMessageBroker: In-memory message broker abstraction
- IEventBroker: Event-driven architecture support
- InMemory Implementations: Ready-to-use broker implementations
π¨ Expressions
- ConditionalExpression: TLINQ and JSON compatible conditional expression
- RuleExpression: TLINQ and JSON compatible business rule evaluation engine
πΊοΈ Mapping
- IMappable: Interface for object mapping
- Extensions: Object-to-dictionary and dictionary-to-object mapping
Installation
Install via NuGet Package Manager:
dotnet add package UA.Tenet
Or via Package Manager Console:
Install-Package UA.Tenet
Quick Start
Using Services with Dependency Injection
using UA.Tenet.Services;
using UA.Tenet.Services.Extensions;
// Register Tenet services
builder.Services.AddTenetServices();
// Define your service (services have a scoped lifetime by default)
[TenetService]
public class MyService : ServiceBase
{
public void DoWork()
{
// Your logic here
}
}
Using the Result Pattern
using UA.Tenet.Design;
public Result<Customer> GetCustomer(int id)
{
Result<Customer> result = new();
if (_repository.FindById(id) is Customer customer)
{
result.Value = customer;
}
else
{
Any<object?> error = new() { ["Message"] = "Customer not found" };
result.WithErrors(id.ToString(), error);
}
return result;
}
Working with Smart Enums
using UA.Tenet.Enums;
public class OrderStatus : SmartEnum<OrderStatus>
{
public static readonly OrderStatus Pending = new(1, "Pending");
public static readonly OrderStatus Confirmed = new(2, "Confirmed");
public static readonly OrderStatus Shipped = new(3, "Shipped");
private OrderStatus(int value, string name) : base(value, name) { }
}
Using Agents
using UA.Tenet.Agents;
using UA.Tenet.Agents.Extensions;
// Register Tenet agents
builder.Services.AddTenetAgents();
// Define your agent (agents have a singleton lifetime by default)
[TenetAgent]
public class ProcessingAgent : AgentBase
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
// Background processing logic
}
}
Tenet Framework Principles
The Tenet Framework is built on five core principles (AEIOU):
- Accessibility: Seamless integration and resource provisioning
- Extension: Modularity and adaptability through reusable components
- Independence: Loose coupling and high cohesion
- Order: Clear and consistent project structure
- Unicity: Unique implementation of responsibilities
Documentation
For comprehensive documentation, tutorials, and API reference, visit:
- π Official Documentation
- π API Reference
Made with β€οΈ by UA Devs @ Chiclana de la Frontera (Spain)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 is compatible. 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. |
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.13)
-
net8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.13)
-
net9.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.13)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on UA.Tenet:
| Package | Downloads |
|---|---|
|
UA.Azure.Storage
UA.Azure.Storage provides a lightweight, efficient implementation for accessing Azure Storage Services (Blob, Queue, and Table) in .NET applications. Built on the Tenet Framework principles, it offers a simplified agent-based approach to interact with Azure Storage without heavy SDK dependencies. |
|
|
UA.Tenet.Web
UA.Tenet.Web extends the Tenet Framework for ASP.NET Core applications. It provides a unified convention-based configuration combining the structure of Controller-based APIs with the performance of Minimal APIs, along with TagHelpers, view components, and web extensions. |
GitHub repositories
This package is not used by any popular GitHub repositories.
See https://tenet.uadevs.org/ for release notes and documentation.