TAF.MetaData.SDK
10.0.3
dotnet add package TAF.MetaData.SDK --version 10.0.3
NuGet\Install-Package TAF.MetaData.SDK -Version 10.0.3
<PackageReference Include="TAF.MetaData.SDK" Version="10.0.3" />
<PackageVersion Include="TAF.MetaData.SDK" Version="10.0.3" />
<PackageReference Include="TAF.MetaData.SDK" />
paket add TAF.MetaData.SDK --version 10.0.3
#r "nuget: TAF.MetaData.SDK, 10.0.3"
#:package TAF.MetaData.SDK@10.0.3
#addin nuget:?package=TAF.MetaData.SDK&version=10.0.3
#tool nuget:?package=TAF.MetaData.SDK&version=10.0.3
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.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.10.11)
- TAF.Infra.ErrorHandling (>= 1.0.0)
- TAF.Infra.MassTransit (>= 2.2.4)
- 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.0.3 | 50 | 3/5/2026 |
| 10.0.2 | 95 | 2/24/2026 |
| 10.0.1 | 137 | 2/10/2026 |
| 10.0.0 | 109 | 2/2/2026 |
| 9.3.4 | 96 | 1/22/2026 |
| 9.3.3 | 123 | 1/15/2026 |
| 9.3.2 | 186 | 1/12/2026 |
| 9.3.1 | 107 | 1/9/2026 |
| 9.3.0 | 173 | 1/3/2026 |
| 9.2.2 | 154 | 12/30/2025 |
| 9.2.1 | 113 | 12/30/2025 |
| 9.2.0 | 289 | 12/12/2025 |
| 9.1.0 | 150 | 12/12/2025 |
| 9.0.5 | 379 | 11/11/2025 |
| 9.0.4 | 226 | 11/4/2025 |
| 9.0.0 | 213 | 11/4/2025 |
| 8.0.0 | 219 | 10/29/2025 |
| 7.4.0 | 207 | 10/28/2025 |
| 7.2.3 | 142 | 10/25/2025 |
| 7.2.0 | 180 | 10/24/2025 |