TAF.MetaData.SDK
10.2.1
dotnet add package TAF.MetaData.SDK --version 10.2.1
NuGet\Install-Package TAF.MetaData.SDK -Version 10.2.1
<PackageReference Include="TAF.MetaData.SDK" Version="10.2.1" />
<PackageVersion Include="TAF.MetaData.SDK" Version="10.2.1" />Directory.Packages.props
<PackageReference Include="TAF.MetaData.SDK" />Project file
paket add TAF.MetaData.SDK --version 10.2.1
#r "nuget: TAF.MetaData.SDK, 10.2.1"
#:package TAF.MetaData.SDK@10.2.1
#addin nuget:?package=TAF.MetaData.SDK&version=10.2.1Install as a Cake Addin
#tool nuget:?package=TAF.MetaData.SDK&version=10.2.1Install as a Cake Tool
TAF Metadata Client SDK
A professional, HTTP-based SDK for consuming TAF Metadata Service APIs. This SDK follows Clean Architecture and SOLID principles, providing enterprise-grade metadata retrieval capabilities with automatic context resolution.
π New in v6.0.0
- Connection Management - Get database connections by environment or application
- Self-Contained Package - All required DLLs bundled (no external dependencies)
- Removed SDK.Contracts - Now uses bundled Contracts/Domain types directly
- Breaking Change - Consumers using
TAF.MetaData.SDK.Contractsnamespace must update toTAF.MetaData.ContractsorTAF.MetaData.Domain
ποΈ Architecture & Design Principles
β
Clean Architecture - Proper separation of layers: Client, Infrastructure, Services, Interfaces, Core
β
SOLID Principles - Single responsibility, dependency inversion, interface segregation
β
Industry Standards - Follows AWS, Azure, Stripe SDK naming conventions
β
HTTP-First - Lightweight, direct API communication
β
Auto Context Resolution - Automatic TenantId/AppId extraction from headers
β
Comprehensive Error Handling - Proper exception mapping and status codes
β
Dependency Injection - Seamless .NET DI integration with validation
π¦ Installation
dotnet add package TAF.MetaData.SDK
π Quick Start
1. Configuration
Add metadata service configuration to your appsettings.json:
{
"MetadataService": {
"BaseUrl": "https://your-metadata-service.com",
"Timeout": 30
}
}
2. Service Registration
Simple configuration from appsettings:
using TAF.MetaData.SDK.Extensions;
var builder = WebApplication.CreateBuilder(args);
// One-line registration with appsettings
builder.Services.AddMetadataClient(builder.Configuration);
var app = builder.Build();
Advanced manual configuration:
// Custom configuration
builder.Services.AddMetadataClient(options =>
{
options.BaseUrl = "https://metadata-api.production.com";
options.TimeoutSeconds = 45;
});
3. Usage
Inject and use the client in your services:
public class MyService
{
private readonly IMetadataClient _metadataClient;
public MyService(IMetadataClient metadataClient)
{
_metadataClient = metadataClient;
}
public async Task<AppObjectResponse?> GetUserProfile()
{
// Context (TenantId, AppId) automatically resolved from HTTP headers
return await _metadataClient.GetAppObjectAsync(
appObjectName: "UserProfile",
version: "1.2.0" // optional
);
}
}
4. HTTP Headers (Required)
Ensure your HTTP requests include the required context headers:
GET /api/myendpoint
TenantId: 123e4567-e89b-12d3-a456-426614174000
AppId: 987fcdeb-51a2-43d1-9f12-345678901234
CorrelationId: req-12345-67890 (optional)
π API Reference
IMetadataClient
GetAppObjectAsync
Task<AppObjectResponse?> GetAppObjectAsync(
string appObjectName,
string? version = null,
CancellationToken cancellationToken = default)
Parameters:
appObjectName- Name of the application object to retrieveversion- Optional version filter (default: null)cancellationToken- Cancellation token
Returns: AppObjectResponse if found, null if not found
Throws:
ArgumentException- When appObjectName is null/emptyInvalidOperationException- When required headers are missingMetadataServiceException- When service operation fails
GetConnectionsByEnvironmentAsync (New in v6.0)
Task<OperationResult<IEnumerable<ConnectionDto>>> GetConnectionsByEnvironmentAsync(
Guid appEnvironmentId,
BusContext context,
CancellationToken cancellationToken = default)
Parameters:
appEnvironmentId- The application environment identifiercontext- Context containing TenantId, AppId, CorrelationIdcancellationToken- Cancellation token
Returns: OperationResult containing collection of connections for the environment
GetConnectionsByAppAsync (New in v6.0)
Task<OperationResult<IEnumerable<ConnectionDto>>> GetConnectionsByAppAsync(
Guid appId,
BusContext context,
CancellationToken cancellationToken = default)
Parameters:
appId- The application identifiercontext- Context containing TenantId, AppId, CorrelationIdcancellationToken- Cancellation token
Returns: OperationResult containing collection of connections for the application
π Response Models
AppObjectResponse
public class AppObjectResponse
{
public Guid Id { get; set; }
public Guid TenantId { get; set; }
public Guid AppId { get; set; }
public Guid AppObjectId { get; set; }
public string AppObjectName { get; set; }
public string AppObjectJson { get; set; }
public string? Version { get; set; }
public bool IsCustom { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
ποΈ Clean Architecture Structure
TAF.Metadata.SDK/
βββ Client/ # Consumer-facing implementations
β βββ HttpMetadataClient.cs
βββ Infrastructure/ # External dependencies (HTTP context)
β βββ HttpContextProvider.cs
βββ Services/ # Internal business services
β βββ MetadataUrlBuilder.cs
β βββ MetadataHttpRequestFactory.cs
β βββ MetadataResponseProcessor.cs
βββ Interfaces/ # Contracts/abstractions
β βββ IMetadataClient.cs
β βββ IContextProvider.cs
β βββ ...
βββ Core/ # Domain objects
β βββ MetadataContext.cs
βββ Configuration/ # Options pattern
β βββ MetadataServiceOptions.cs
βββ Extensions/ # DI registration
βββ ServiceCollectionExtensions.cs
π― SOLID Principles Implementation
Single Responsibility Principle (SRP)
- HttpMetadataClient - Orchestrates the request flow
- MetadataUrlBuilder - Builds URLs only
- MetadataHttpRequestFactory - Creates HTTP requests only
- MetadataResponseProcessor - Processes responses only
- HttpContextProvider - Resolves context from headers only
Open/Closed Principle (OCP)
- SDK is extensible via interfaces
- New response processors or context providers can be added
Dependency Inversion Principle (DIP)
- All dependencies via abstractions (
IMetadataClient,IContextProvider) - Easy to mock and test
Interface Segregation Principle (ISP)
- Small, focused interfaces
- Each interface has a single responsibility
β‘ Auto Context Resolution
The SDK automatically extracts context from HTTP request headers:
// No manual context needed - extracted automatically!
var appObject = await _metadataClient.GetAppObjectAsync("UserProfile");
// Behind the scenes:
// 1. HttpContextProvider reads Request.Headers["TenantId"]
// 2. HttpContextProvider reads Request.Headers["AppId"]
// 3. HttpContextProvider reads Request.Headers["CorrelationId"] (optional)
// 4. Context passed to metadata service automatically
π‘οΈ Error Handling
try
{
var userProfile = await _metadataClient.GetAppObjectAsync("UserProfile");
if (userProfile == null)
{
// Object not found (404)
Console.WriteLine("UserProfile not found");
}
}
catch (InvalidOperationException ex)
{
// Missing required headers
Console.WriteLine($"Missing context: {ex.Message}");
}
catch (MetadataServiceException ex)
{
// Service errors (network, timeout, API errors)
Console.WriteLine($"Service error: {ex.Message}, Status: {ex.StatusCode}");
}
π§ Configuration Options
MetadataServiceOptions
public class MetadataServiceOptions
{
public string BaseUrl { get; set; } = string.Empty;
public int TimeoutSeconds { get; set; } = 30;
}
Configuration validation:
BaseUrl- Required, must be valid URLTimeoutSeconds- Must be between 1 and 300 seconds
π Key Features
- π Industry Standard Naming - IMetadataClient follows AWS/Azure patterns
- β‘ One-Line Setup -
AddMetadataClient(configuration) - π€ Auto Context - No manual TenantId/AppId passing
- π‘οΈ Secure - Fixed SSL certificate validation
- π Lightweight - HTTP-only, no message bus dependencies
- π§ͺ Testable - All dependencies mockable via interfaces
- βοΈ Configurable - Supports both appsettings and manual config
π¦ Dependencies
- .NET 8.0+ - Modern .NET runtime
- Microsoft.AspNetCore.Http - HTTP context access
- Microsoft.Extensions.DependencyInjection - DI container
- Microsoft.Extensions.Http - HTTP client factory
- System.ComponentModel.Annotations - Configuration validation
π€ Contributing
This SDK is maintained by the TAF Development Team. For issues or feature requests, please contact the development team.
π License
MIT License - see LICENSE file for details.
π€ Generated with Claude Code
| 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 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 was computed. 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. |
-
net8.0
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.Extensions.Caching.Memory (>= 9.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.8)
- Microsoft.Extensions.DependencyInjection (>= 9.0.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Http (>= 9.0.8)
- Microsoft.Extensions.Options (>= 9.0.8)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.8)
- System.ComponentModel.Annotations (>= 5.0.0)
- TAF.Infra.Contract (>= 1.11.5)
- TAF.Infra.ErrorHandling (>= 1.0.1)
- TAF.Infra.MassTransit (>= 2.2.21)
- TAF.Infra.QueryHook (>= 2.0.4)
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 |
|---|---|---|
| 10.2.1 | 183 | 6/29/2026 |
| 10.1.6 | 157 | 6/25/2026 |
| 10.1.5 | 200 | 5/20/2026 |
| 10.1.4 | 361 | 5/12/2026 |
| 10.1.3 | 398 | 4/15/2026 |
| 10.1.2 | 162 | 4/1/2026 |
| 10.0.3 | 161 | 3/5/2026 |
| 10.0.2 | 131 | 2/24/2026 |
| 10.0.1 | 167 | 2/10/2026 |
| 10.0.0 | 136 | 2/2/2026 |
| 9.3.4 | 133 | 1/22/2026 |
| 9.3.3 | 176 | 1/15/2026 |
| 9.3.2 | 721 | 1/12/2026 |
| 9.3.1 | 136 | 1/9/2026 |
| 9.3.0 | 247 | 1/3/2026 |
| 9.2.2 | 191 | 12/30/2025 |
| 9.2.1 | 140 | 12/30/2025 |
| 9.2.0 | 378 | 12/12/2025 |
| 9.1.0 | 182 | 12/12/2025 |
| 9.0.5 | 430 | 11/11/2025 |