Professional HTTP-based SDK for TAF Metadata Service. v10.0.0: Clean release - no caching dependencies. Features Clean Architecture, SOLID principles, explicit BusContext parameter support, comprehensive error handling, screen management, batch relations support, and GUID-based lookups.
$ dotnet add package TAF.MetaData.SDKA 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.
TAF.MetaData.SDK.Contracts namespace must update to TAF.MetaData.Contracts or TAF.MetaData.Domain✅ 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
dotnet add package TAF.MetaData.SDK
Add metadata service configuration to your appsettings.json:
{
"MetadataService": {
"BaseUrl": "https://your-metadata-service.com",
"Timeout": 30
}
}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;
});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
);
}
}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)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 tokenReturns: AppObjectResponse if found, null if not found
Throws:
ArgumentException - When appObjectName is null/emptyInvalidOperationException - When required headers are missingMetadataServiceException - When service operation failsTask<OperationResult<IEnumerable<ConnectionDto>>> GetConnectionsByEnvironmentAsync(
Guid appEnvironmentId,
BusContext context,
CancellationToken cancellationToken = default)Parameters:
appEnvironmentId - The application environment identifiercontext - Context containing TenantId, AppId, CorrelationIdcancellationToken - Cancellation tokenReturns: OperationResult containing collection of connections for the environment
Task<OperationResult<IEnumerable<ConnectionDto>>> GetConnectionsByAppAsync(
Guid appId,
BusContext context,
CancellationToken cancellationToken = default)Parameters:
appId - The application identifiercontext - Context containing TenantId, AppId, CorrelationIdcancellationToken - Cancellation tokenReturns: OperationResult containing collection of connections for the application
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; }
}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
IMetadataClient, IContextProvider)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 automaticallytry
{
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}");
}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 secondsAddMetadataClient(configuration)This SDK is maintained by the TAF Development Team. For issues or feature requests, please contact the development team.
MIT License - see LICENSE file for details.
🤖 Generated with Claude Code