SmartCoreHub.Core.SDK
20260725.502.0
dotnet add package SmartCoreHub.Core.SDK --version 20260725.502.0
NuGet\Install-Package SmartCoreHub.Core.SDK -Version 20260725.502.0
<PackageReference Include="SmartCoreHub.Core.SDK" Version="20260725.502.0" />
<PackageVersion Include="SmartCoreHub.Core.SDK" Version="20260725.502.0" />
<PackageReference Include="SmartCoreHub.Core.SDK" />
paket add SmartCoreHub.Core.SDK --version 20260725.502.0
#r "nuget: SmartCoreHub.Core.SDK, 20260725.502.0"
#:package SmartCoreHub.Core.SDK@20260725.502.0
#addin nuget:?package=SmartCoreHub.Core.SDK&version=20260725.502.0
#tool nuget:?package=SmartCoreHub.Core.SDK&version=20260725.502.0
SmartCoreHub.Core.SDK
Biblioteca NuGet central do SmartCoreHub: primitivas de domínio, Result/Guard, contratos de cache/NoSql/cloud, helpers e — nos TFMs modernos — implementações reutilizáveis de repositórios genéricos (EF Core / Dapper), providers de cache (Redis, Mongo, Cosmos, Disk), adapters Azure, CQRS/OpenTelemetry e banda ASP.NET (serviços básicos, proxy reverso, Data Protection, Application Insights, middleware, CORS, documentação OpenAPI, performance, health/readiness, JWT claims-based e BaseApiController).
NuGet: https://www.nuget.org/packages/SmartCoreHub.Core.SDK/
Use este pacote quando precisar da mesma fonte de contratos e implementações genéricas entre APIs, hosts .NET e SDKs que optarem por referenciar o Core.
Hosts SmartCoreHub: as implementações genéricas de hosting vivem em
SmartCoreHub.Core.SDK.Service.API.DI: ASP.NET basics, Application Insights condicional, Forwarded Headers, Data Protection, performance, middleware transversal, documentação e health/readiness. OSmartCoreHub.Servicemantém somente as fachadas de composição, branding, autenticação específica do produto, DI de features e startup do banco.Localization.SDK: pacote público auto-isolado — não depende deste Core no NuGet. Tipos HTTP/cache leves usados pelo Localization são cópia owned. Ver Isolamento-Core.md.
Extração Service → Core: Service-Extracao.md.
Documentação no pacote (humano + IA)
| Arquivo | Para quem | Conteúdo |
|---|---|---|
README.md (este) |
Humanos / overview | Instalação, TFMs, quick starts, catálogo resumido por área |
API-CATALOG.md |
Humanos + IA | Inventário completo (~291 tipos públicos) com métodos e propriedades |
AI-CONTEXT.md |
Agentes de IA | Playbook curto de migração legado → NuGet |
MIGRATION-GUIDE.md |
Humanos + IA | Guia prático passo a passo + before/after + checklist por camada |
CHANGELOG.md |
Humanos | Notas de mudança / alinhamento com extensões IDE |
SmartCoreHub.Core.SDK-Extensões-IDE-Requisitos.md |
Produto / engenharia | RF, arquitetura, Extensões IDE, fases 1–6 |
| Extensões IDE | Projeto separado | ../SmartCoreHub.Core.SDK.Extensions/ (fora do NuGet) |
| XML-doc na DLL | IDE / IntelliSense | GenerateDocumentationFile=true |
Contexto para IA (além do README)
- Anexar no chat /
@:AI-CONTEXT.md+API-CATALOG.md+MIGRATION-GUIDE.md. - Cursor Rule:
.cursor/rules/smartcorehub-core-sdk-migration.mdc. - Pacote NuGet: markdowns na raiz do nupkg →
%USERPROFILE%\.nuget\packages\smartcorehub.core.sdk\<versão>\. - XML-doc +
.snupkg: IntelliSense sem clonar o monólito. - Extensões IDE (projeto separado):
../SmartCoreHub.Core.SDK.Extensions/— VS Code/Cursor.vsix, snippets JSON, instalador. - Mapa estruturado:
../SmartCoreHub.Core.SDK.Extensions/shared/maps/legacy-to-sdk.json.
NuGet: https://www.nuget.org/packages/SmartCoreHub.Core.SDK/
Instalação
dotnet add package SmartCoreHub.Core.SDK
<PackageReference Include="SmartCoreHub.Core.SDK" Version="*" />
Versões: https://www.nuget.org/packages/SmartCoreHub.Core.SDK/
Frameworks suportados
| TFM | Tipos leves (contratos, Result, Memory/Disk cache, helpers) | Tipos pesados + banda ASP.NET (Dapper, EF, Redis, Mongo, Cosmos, Azure, middleware, docs) |
|---|---|---|
netstandard2.0 |
Sim | Não |
netstandard2.1 |
Sim | Não |
net6.0 |
Sim | Não |
net8.0 |
Sim | Sim |
net10.0 |
Sim | Sim (+ OpenAPI nativo ASP.NET) |
Dependências pesadas (Dapper, EF Core, StackExchange.Redis, MongoDB.Driver, Azure SDKs, Application Insights, Swashbuckle, Scalar, ReDoc, RapiDoc, etc.) entram no grafo NuGet somente quando o projeto consumidor tem como alvo net8.0 ou net10.0.
Light vs heavy
- Light: todos os TFMs — Domain (Result/Guard/exceptions/helpers, entidades base, DTOs), Infrastructure (cache Memory/Disk, repositórios Guid, abstrações NoSql), Service (HTTP leve, headers, helpers sem ASP.NET).
- Heavy (
net8/net10): repositórios Dapper/EF, factories/adapters Azure, Redis/Mongo/Cosmos, Serilog adapter, AutoMapper adapter, sanitização HTML, banda ASP.NET completa.
CacheFactory (namespace Service) cria apenas o provider Memory. Em produção, registre Redis/Disk/Mongo/Cosmos pelos tipos deste pacote (ou via AddSdkCaching()).
Mapa de namespaces
| Namespace | Conteúdo típico | TFM |
|---|---|---|
SmartCoreHub.Core.SDK.Domain.* |
Result, Guard, exceptions, ValueObject, helpers/extensions, entidades, DTOs, enums, interfaces | todos |
SmartCoreHub.Core.SDK.Infrastructure.* |
Cache light/heavy, repositórios Guid, IUnitOfWork, dialect/resolvers, password hashers, NoSql |
todos (+ heavy em net8/10) |
SmartCoreHub.Core.SDK.Infrastructure.Abstractions |
IUnitOfWork |
todos |
SmartCoreHub.Core.SDK.Infrastructure.Repositories.GuidKeyed |
IRepository<T> / IReadRepository<T> (identificador Guid) |
todos |
SmartCoreHub.Core.SDK.Dapper.Generic / .Persistence |
Repositório Dapper + factory | net8/10 |
SmartCoreHub.Core.SDK.EntityFrameworkCore[.Repositories] |
GenericRepository<T>, EfUnitOfWork |
net8/10 |
SmartCoreHub.Core.SDK.Caching.{Redis,Mongo,Cosmos} |
Providers de cache pesados | net8/10 |
SmartCoreHub.Core.SDK.NoSql.Mongo.* |
Adapters Mongo | net8/10 |
SmartCoreHub.Core.SDK.Cloud.Azure |
Blob/Queue/Table adapters e factories | net8/10 |
SmartCoreHub.Core.SDK.Client.Cloud.* |
Cliente HTTP JWT (Auth/Blob/Queue/Table) — ex-CloudClientSDK | net8/10 |
SmartCoreHub.Core.SDK.Service.* |
ServiceResult, TokenHelper, IpAddressHelper, config, HTTP leve | todos |
SmartCoreHub.Core.SDK.Service.Http[.Abstractions|.Authentication] |
Executor HTTP, Accept-Language, API key headers | todos |
SmartCoreHub.Core.SDK.Service.API.DI |
ASP.NET basics (+ IUserContext accessor), AddSdkCorePrimitives, Application Insights, Forwarded Headers, Data Protection, CORS, Swagger/OpenAPI/UIs, ApiPerformance, middleware bundle e health/readiness |
net8/10 |
SmartCoreHub.Core.SDK.Service.API.Middleware |
CorrelationId, SecurityHeaders, RequestLogging, RequestSizeLimit, LocalizationHeaderCulture | net8/10 |
SmartCoreHub.Core.SDK.Service.API.Generic |
BaseApiController |
net8/10 |
SmartCoreHub.Core.SDK.Service.Security |
IJwtAccessTokenService / JwtAccessTokenService |
net8/10 |
SmartCoreHub.Core.SDK.Infrastructure.Data.DependencyInjection |
AddConfiguredDbContext<TContext> |
net8/10 |
SmartCoreHub.Core.SDK.Application.Cqrs.* |
Contratos CQRS, pipeline, behaviors, ServiceResponseFactory |
net8/10 |
SmartCoreHub.Core.SDK.Application.Cqrs.MediatR |
AddSmartCoreHubMediatRAdapter, MediatRApplicationDispatcher |
net8/10 |
SmartCoreHub.Core.SDK.Application.Transactions |
ITransactionExecutor / NoOpTransactionExecutor |
net8/10 |
SmartCoreHub.Core.SDK.Application.Observability |
SmartCoreHubActivitySources (ActivitySource/meters) |
net8/10 |
SmartCoreHub.Core.SDK.Service.Hosting |
OpenTelemetry, HttpClient defaults, health Redis/DbContext | net8/10 |
Layout em disco: Domain/, Infrastructure/, Service/, Application/, Client/.
Catálogo exaustivo (todos os tipos + métodos):
API-CATALOG.md.
Quick start — CQRS (net8/net10)
TResult é o payload. O dispatcher e os handlers retornam ServiceResponse<TResult>. Controllers usam apenas IApplicationDispatcher — nunca IMediator/ISender.
using SmartCoreHub.Core.SDK.Application.Cqrs.Abstractions;
using SmartCoreHub.Core.SDK.Application.Cqrs.MediatR;
using SmartCoreHub.Core.SDK.Domain.DTOs.Common;
// Registro (host/produto):
services.AddSmartCoreHubMediatRAdapter(typeof(CreateSomethingHandler).Assembly);
public sealed record CreateSomethingCommand(string Name) : ICommand<Guid>, IHasValidationPayload<CreateSomethingDto>
{
public CreateSomethingDto Payload => new(Name);
}
public sealed class CreateSomethingHandler : ICommandHandler<CreateSomethingCommand, Guid>
{
public Task<ServiceResponse<Guid>> HandleAsync(
CreateSomethingCommand command,
CancellationToken cancellationToken = default)
=> Task.FromResult(ServiceResponse<Guid>.Ok(Guid.NewGuid()));
}
// Controller / composition root:
public sealed class SomethingController(IApplicationDispatcher dispatcher)
{
public Task<ServiceResponse<Guid>> Create(CreateSomethingCommand command, CancellationToken ct)
=> dispatcher.SendAsync(command, ct);
}
Pipeline efetivo (Fase 4): UnhandledException → Logging → Performance → Validation → Transaction → Handler.
TransactionBehavior é opt-in via ITransactionalCommand + ITransactionExecutor (EF na Infrastructure).
Na avaliação da Fase 8, CachingBehavior não foi ativado: não há queries CQRS com política estável de chave/TTL/invalidação, e o hot path de Localization continua no cache dedicado existente. ICacheableQuery permanece apenas como contrato de extensão para uma entrega futura com semântica explícita.
Envelope HTTP: o padrão é
ServiceResponse<T>. Endpoints específicos deSmartCoreHub.Localization.APIpodem documentar respostas mais limpas sem o envelope quando a superfície HTTP exigir.
Quick start — host ASP.NET (net8/net10)
Exemplo de host genérico (sem dependências do monólito). O host continua responsável por registrar seu DbContext, autenticação, autorização e controllers de feature.
using Microsoft.EntityFrameworkCore;
using SmartCoreHub.Core.SDK.Service.API.DI;
using SmartCoreHub.Core.SDK.Service.Hosting;
var builder = WebApplication.CreateBuilder(args);
// Serviços básicos e infraestrutura de hosting.
builder.Services.AddAspNetCoreApiBasics();
builder.Services.AddSdkCorePrimitives(includeNullAppLogger: false); // host registra Serilog depois
builder.AddApplicationInsightsIfConfigured();
builder.AddApiPerformance();
builder.AddSmartCoreHubOpenTelemetry();
builder.AddSmartCoreHubHttpClientDefaults();
builder.Services.AddForwardedHeadersFromConfiguration(
builder.Configuration,
builder.Environment);
builder.Services.AddFileSystemDataProtection(
builder.Configuration,
builder.Environment);
var docs = OpenApiDocumentationOptions.Create(
builder.Configuration,
defaults: new OpenApiDocumentationOptions
{
Title = "My API",
Description = "API reutilizando SmartCoreHub.Core.SDK",
ContactName = "Team",
ContactEmail = "support@example.com"
},
configure: options =>
{
// Override final por host (opcional).
// options.Title = "My API (override)";
});
builder.Services.AddCustomSwagger(docs);
builder.Services.AddCustomOpenApi(docs); // efeito real em net10+
builder.Services.AddCustomCors(
builder.Configuration,
builder.Environment,
new CorsHostingOptions { PrivatePolicyName = "AllowMyFrontend" });
builder.Services.AddDbContext<MyDbContext>(options =>
{
// Configure aqui o provider EF Core do host.
});
builder.Services.AddAuthentication();
builder.Services.AddAuthorization();
var app = builder.Build();
app.UseHttpsRedirection();
app.UseForwardedHeaders();
app.UseRouting();
app.UseSmartCoreHubCrossCuttingMiddleware();
app.UseApiPerformance();
CorsExtensions.SetupCors(app, new CorsHostingOptions { PrivatePolicyName = "AllowMyFrontend" });
app.UseAndMapApiDocumentation(docs);
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.MapBasicLiveness();
app.MapDatabaseReadiness<MyDbContext>();
app.Run();
Configurações reconhecidas pelas novas extensions:
| Seção / variável | Finalidade |
|---|---|
APPLICATIONINSIGHTS_CONNECTION_STRING ou ApplicationInsights:ConnectionString |
Habilita Application Insights |
APPINSIGHTS_INSTRUMENTATIONKEY ou ApplicationInsights:InstrumentationKey |
Habilita Application Insights pelo formato legado |
ForwardedHeaders:KnownProxies |
Lista de endereços IP de proxies confiáveis |
ForwardedHeaders:KnownNetworks |
Lista de redes confiáveis em CIDR |
DataProtection:KeysPath |
Diretório absoluto ou relativo do key ring |
DataProtection:ApplicationName |
Isolamento lógico dos payloads protegidos |
Composição no monólito SmartCoreHub
O Service preserva as fachadas públicas usadas pelas duas APIs:
WebApplicationBuilderServicesConfigure.Configure(builder);
var app = builder.Build();
app.ConfigurePipeline();
Internamente, o registro é agrupado por AddSmartCoreHubHostingInfrastructure,
AddSmartCoreHubApplicationServices, AddSmartCoreHubApiSurface e
AddSmartCoreHubCrossCuttingServices. O pipeline usa
UseSmartCoreHubNetworkAndCrossCutting, UseSmartCoreHubCorsAndDocumentation,
UseSmartCoreHubSecurityAndEndpoints e UseSmartCoreHubStartupAndRequestLogging.
Esses oito métodos são orquestração específica do produto e, portanto, permanecem no Service.
Catálogo reutilizável (detalhado)
Cada tipo público listado abaixo pode ser reutilizado por consumidores do pacote. Tipos em pastas Internal não devem ser dependência estável.
Lista exaustiva (~291 tipos + métodos/propriedades):
API-CATALOG.md.
Migração com IA:AI-CONTEXT.md.
Service.API.DI — hosting, documentação e health (net8/net10)
Options
| Tipo | Propriedades principais | Uso |
|---|---|---|
OpenApiDocumentationOptions |
DocumentName, Title, Description, ContactName, ContactEmail, SwaggerUiRoutePrefix, RedocRoutePrefix, RapiDocRoutePrefix, OpenApiDocumentRoute, OpenApiDocumentUrl, SwaggerDocumentUrl, ScalarDocumentUiRoute, nomes/títulos das UIs; Create(configuration, defaults, configure) resolve defaults → seção OpenApiDocumentation → override do consumidor |
Parametriza marca e rotas das UIs |
CorsHostingOptions |
PrivatePolicyName (default AllowConfiguredOrigins), PrivateAllowedHostsValue (Private), AllowedOriginsSection (Cors:AllowedOrigins), ExposedHeaders |
CORS privado vs aberto |
ApiPerformanceOptions |
PermitLimit (100), Window (1 min), ApiKeyHeaderName (X-Auth-Token), PartitionKeyFactory |
Rate limit e tuning |
Extensions e métodos
| Classe | Método | Assinatura resumida | Descrição |
|---|---|---|---|
AspNetCoreApiBasicsExtensions |
AddAspNetCoreApiBasics |
IServiceCollection AddAspNetCoreApiBasics(this IServiceCollection) |
Registra controllers, IHttpContextAccessor e EndpointsApiExplorer |
ApplicationInsightsServiceCollectionExtensions |
AddApplicationInsightsIfConfigured |
WebApplicationBuilder AddApplicationInsightsIfConfigured(this WebApplicationBuilder) |
Registra telemetria somente quando connection string ou instrumentation key estiver configurada |
ForwardedHeadersServiceCollectionExtensions |
AddForwardedHeadersFromConfiguration |
IServiceCollection AddForwardedHeadersFromConfiguration(this IServiceCollection, IConfiguration, IHostEnvironment) |
Configura X-Forwarded-For/X-Forwarded-Proto; Development limpa listas e demais ambientes usam proxies/redes confiáveis |
DataProtectionServiceCollectionExtensions |
AddFileSystemDataProtection |
IServiceCollection AddFileSystemDataProtection(this IServiceCollection, IConfiguration, IHostEnvironment) |
Persiste o key ring em filesystem e define o application name |
SwaggerExtensions |
AddCustomSwagger |
IServiceCollection AddCustomSwagger(this IServiceCollection, OpenApiDocumentationOptions?) |
SwaggerGen + XML docs + esquema Bearer |
OpenApiExtensions |
AddCustomOpenApi |
IServiceCollection AddCustomOpenApi(this IServiceCollection, OpenApiDocumentationOptions?) |
OpenAPI built-in somente em net10+; em net8 é no-op (método existe, não registra documento) |
OpenApiExtensions |
MapCustomOpenApi |
WebApplication MapCustomOpenApi(this WebApplication, OpenApiDocumentationOptions?) |
Em net10+: mapeia JSON OpenAPI + Swagger UI. Em net8: configura apenas Swagger UI |
ScalarExtensions |
MapCustomScalar |
WebApplication MapCustomScalar(this WebApplication, OpenApiDocumentationOptions?) |
Scalar + redirect /openapi |
RedocExtensions |
MapCustomRedoc |
WebApplication MapCustomRedoc(this WebApplication, OpenApiDocumentationOptions?) |
UI ReDoc |
RapiDocExtensions |
MapCustomRapiDoc |
WebApplication MapCustomRapiDoc(this WebApplication, OpenApiDocumentationOptions?) |
UI RapiDoc |
CorsExtensions |
AddCustomCors |
IServiceCollection AddCustomCors(this IServiceCollection, IConfiguration, IHostEnvironment, CorsHostingOptions?) |
Registra policy privada ou default aberta (sem BuildServiceProvider) |
CorsExtensions |
SetupCors |
void SetupCors(WebApplication, CorsHostingOptions?) |
Aplica UseCors conforme ambiente/AllowedHosts |
ApiPerformanceExtensions |
AddApiPerformance |
WebApplicationBuilder AddApiPerformance(this WebApplicationBuilder, ApiPerformanceOptions?) |
Kestrel, thread pool, JSON, compression, rate limiting. Lê PerformanceTuning:Kestrel, PerformanceTuning:ThreadPool, PerformanceTuning:Json e PerformanceTuning:MySqlPooling |
ApiPerformanceExtensions |
UseApiPerformance |
WebApplication UseApiPerformance(this WebApplication) |
UseResponseCompression + UseRateLimiter |
ApiPerformanceExtensions |
ApplyMySqlPoolingDefaults |
string ApplyMySqlPoolingDefaults(IConfiguration, string normalizedProvider, string? connectionString) |
Injeta pooling quando provider = MySQL |
ApiPerformanceExtensions |
BuildMySqlConnectionStringWithPoolingDefaults |
string BuildMySqlConnectionStringWithPoolingDefaults(string?, int min, int max, int lifetimeSeconds) |
Monta connection string com defaults |
ApiPerformanceExtensions |
ParseHttpProtocols |
HttpProtocols ParseHttpProtocols(string?) |
Parse seguro (fallback Http1AndHttp2) |
ApiPerformanceExtensions |
ExtractTokenPrefix |
string ExtractTokenPrefix(string tokenHeader) |
Prefixo não secreto de token 4 partes (_) |
SecurityMiddlewareExtensions |
UseSmartCoreHubCrossCuttingMiddleware |
WebApplication UseSmartCoreHubCrossCuttingMiddleware(this WebApplication) |
Aplica cultura por Accept-Language, security headers e correlation id |
ApiDocumentationPipelineExtensions |
UseAndMapApiDocumentation |
WebApplication UseAndMapApiDocumentation(this WebApplication, OpenApiDocumentationOptions?) |
Publica Swagger + OpenAPI/Scalar/ReDoc/RapiDoc e redireciona ///index.html |
HealthEndpointExtensions |
MapBasicLiveness |
WebApplication MapBasicLiveness(this WebApplication, string, string) |
Mapeia liveness independente de banco, por padrão em /health |
DatabaseReadinessExtensions |
MapDatabaseReadiness<TContext> |
WebApplication MapDatabaseReadiness<TContext>(this WebApplication, string, string) |
Mapeia readiness baseada em DbContext.Database.CanConnect(), por padrão em /ready |
DatabaseReadinessExtensions |
ResolveReadiness<TContext> |
IResult ResolveReadiness<TContext>(IServiceProvider) |
Retorna 200 com ready ou 503 sem propagar falhas de infraestrutura |
Rotas padrão resultantes (com options default ou branding SmartCoreHub):
| Recurso | Rota |
|---|---|
| Swagger UI | /swagger |
| Swagger JSON | /swagger/v1/swagger.json |
| OpenAPI nativo | /openapi/v1.json (net10+) |
| Scalar | /scalar/v1 |
| ReDoc | /redoc |
| RapiDoc | /rapidoc |
| Liveness | /health |
| Readiness de banco | /ready |
Service.API.Middleware (net8/net10)
| Middleware | Método | Descrição |
|---|---|---|
CorrelationIdMiddleware |
InvokeAsync(HttpContext) |
Lê/gera X-Correlation-ID e propaga em response, HttpContext.Items e Serilog |
SecurityHeadersMiddleware |
InvokeAsync(HttpContext) |
HSTS (não-dev), X-Frame-Options, X-Content-Type-Options, etc. |
RequestLoggingMiddleware |
InvokeAsync(HttpContext) |
Log estruturado de início/fim e status |
RequestSizeLimitMiddleware |
InvokeAsync(HttpContext) |
Rejeita com 413 quando Content-Length excede o limite (default 10 MiB). Não limita corpos chunked sem Content-Length |
LocalizationHeaderCultureMiddleware |
InvokeAsync(HttpContext) |
Cultura a partir de Accept-Language |
Ordem recomendada no pipeline:
// Bundle padrão usado pelos hosts SmartCoreHub:
app.UseSmartCoreHubCrossCuttingMiddleware();
// Middlewares adicionais conforme a necessidade do host:
app.UseMiddleware<RequestLoggingMiddleware>();
app.UseMiddleware<RequestSizeLimitMiddleware>();
O bundle aplica, nesta ordem, LocalizationHeaderCultureMiddleware,
SecurityHeadersMiddleware e CorrelationIdMiddleware.
Service.API.Generic / Authentication / Helpers (net8/net10)
| Tipo | Membros públicos relevantes | Descrição |
|---|---|---|
BaseApiController |
GetApplicationIdFromClaims(), SetApplicationIdOnUserContext(IUserContext), CurrentUserContext, CurrentApiKeyUserContext, GetApplicationIp(), IsUserAuthenticated(), helpers de resposta |
Controller base [Authorize] |
ApiKeyAuthenticationOptions |
Options do esquema ApiKey ASP.NET | Configuração do handler (handler em si permanece no host) |
LogAppHelper |
PrintLogInformationVersionProduct(ILogger\|IAppLogger), GetInformationVersionProduct(), ShowInformationVersionProductString() |
Banner/versão do produto |
AppInformationVersionProductDto |
DTO de versão | Retorno de GetInformationVersionProduct |
Service.Security — JWT claims-based (net8/net10)
| Tipo | Métodos | Descrição |
|---|---|---|
IJwtAccessTokenService |
GenerateAccessToken(IEnumerable<Claim>), GenerateRefreshToken(), TryGetUserId(string, out long?) |
Contrato sem entidade User |
JwtAccessTokenService |
implementa a interface + BuildStandardAccessClaims(long userId, string name, string email) |
Usa ISecurityTokenAdapterFactory / config de token |
services.AddScoped<IJwtAccessTokenService, JwtAccessTokenService>();
var claims = JwtAccessTokenService.BuildStandardAccessClaims(userId, name, email);
var access = jwt.GenerateAccessToken(claims);
var refresh = jwt.GenerateRefreshToken();
No monólito, JwtTokenService do Service continua como adapter de domínio (User → claims) sobre este serviço.
Service.Common / Configuration / Validation (mistos)
| Tipo | TFM | Métodos / uso |
|---|---|---|
IpAddressHelper |
todos | IsAllowedIp, IsTrustedProxy, IsIpInCidr, NormalizeIp |
AspNetIpAddressHelper |
net8/10 | ResolveClientIp(HttpContext?, IEnumerable<string>), ResolveAuditIp(string, HttpContext?) |
ServiceResult / ServiceResult<T> / ServiceResultHelper |
todos | Envelope de operação de aplicação; Success / Failure / ExecuteAsync |
TokenHelper |
todos | TryParseToken, ComputeHash, GeneratePrefix / Secret / Salt, FixedTimeEquals |
ApiKeyCacheKeys |
todos | TokenPrefix(string) |
ConfigurationHelper |
todos | GetSection, GetConnectionString, GetValueString, GetTokenConfigurations |
AppConfigConstants |
todos | Constantes de chaves de configuração |
HttpHeaderNamesHelper |
todos | Nomes de headers HTTP |
ValidationFailure / ValidationErrorMapperHelper |
todos | Mapeamento de erros de validação |
UserContextServiceBase |
todos | SetUserContext / GetUserContext |
CacheFactory |
todos | Memory-only (legado) |
CacheService / InfrastructureCacheProviderResolver |
net8/10 | Orquestração de cache + resolução de provider |
SharedDependeciesCollection / ISharedDependeciesCollection |
todos | Bundle de dependências compartilhadas |
ServiceCollectionValidateExtensions |
todos | ValidateNoCircularDependencies() |
Infrastructure.Data.DependencyInjection (net8/net10)
| Método | Assinatura | Descrição |
|---|---|---|
AddConfiguredDbContext<TContext> |
IServiceCollection AddConfiguredDbContext<TContext>(this IServiceCollection, Action<DbContextOptionsBuilder>) where TContext : DbContext |
Registra TContext + abstração DbContext |
services.AddConfiguredDbContext<MyDbContext>(options =>
options.UseMySql(connectionString, serverVersion));
Domain — Result, validação, helpers e exceptions
| Tipo | Namespace | Descrição |
|---|---|---|
Result / Result<T> / Error / PaginatedResult<T> |
Domain.Common |
Padrão Result e envelope de página |
Guard |
Domain.Validation |
Guards de argumento |
SmartCoreHubSdkException e derivadas |
Domain.Exceptions |
Exceptions tipadas do SDK |
StringHelper / StringExtensions |
Domain.Helpers / Domain.Extensions |
Utilitários de string |
DateTimeHelper / DateTimeExtensions |
Domain.Helpers / Domain.Extensions |
Utilitários de data/hora |
ValueObject |
Domain.ValueObjects |
Base de equality estrutural para VOs |
Infrastructure — repositório Guid e cache leve
| Tipo | Namespace | Descrição |
|---|---|---|
IUnitOfWork |
Infrastructure.Abstractions |
Unidade de trabalho |
IRepository<T> / IReadRepository<T> |
Infrastructure.Repositories.GuidKeyed |
Contratos Guid-based |
ILightweightCacheProvider |
Infrastructure.Caching |
Cache leve (sem ICacheProvider host) |
LightweightMemoryCacheProvider |
Infrastructure.Caching.Providers |
Implementação Memory para SDKs de feature |
Service — HTTP / headers
| Tipo | Namespace | Descrição |
|---|---|---|
HttpRequestExecutorBase / HttpExecutionResult<T> |
Service.Http |
Executor HTTP autenticado e resultado tipado |
IAuthHeaderProvider / IApiErrorMapper |
Service.Http.Abstractions |
Contratos de auth header e mapeamento de erro |
ApiKeyAuthHeaderProvider / ApiKeyAuthOptions |
Service.Http.Authentication |
API key em header |
AcceptLanguageHelper |
Service.Http |
Parsing Accept-Language |
Headers |
Service.API.Headers |
Constantes de headers HTTP |
Domain — entidades e value objects
| Tipo | Descrição |
|---|---|
IEntity |
Marcador de entidade |
EntityBase |
Entidade com Guid Id |
AuditableEntity |
Entidade com campos de auditoria |
LongEntityBase |
Entidade com long Id (generics EF/Dapper) |
AuditableLongEntityBase |
LongEntityBase + CreatedUserId/ModifyUserId (sem navs de usuário) |
ValueObject |
Base estrutural para value objects |
Email / Role / ConnectionString |
Value objects |
CloudProvider / CloudRessource |
Enums de nuvem (grafia histórica mantida) |
Domain — enums e DTOs
| Tipo | Descrição |
|---|---|
ECacheProvider / ETypeLocationCache |
Providers / localização de cache |
DatabaseDialect |
SQL Server / MySQL / PostgreSQL |
BaseSearchDto |
DTO base de busca/paginação |
CacheConfigurationDto |
Seção raiz de configuração de cache |
CacheEntryOptions / CacheLoggingOptions |
Opções de entrada e logging |
CacheProviderOptions (+ Memory/Redis/Disk/MongoDb/AzureCosmosDb) |
Opções por provider |
IServiceResponse<T> / ServiceResponse<T> |
Envelope de resposta de serviço |
CultureDisplayDto |
Exibição de cultura |
ITokenConfigurationDto / TokenConfigurationDto |
Configuração de token |
LoginDto / RefreshTokenDto / PasswordVerificationInput |
DTOs de autenticação |
ApiKeyTokenCacheEntry / ApiKeyTokenFormatOptions |
Cache e formato de token de API key |
TokenValidationResult / TokenAuditDeduplicationOptions |
Validação/auditoria de token |
AuditHistoryCriteriaDto / AuditHistoryItemDto |
Consulta de histórico de auditoria |
Generic*ValidationDto (Id, Predicate, Entities, Ids, EntityUpdate) |
DTOs de validação genérica (validators ficam no host) |
Guard validation DTOs (PagingGuardValidationDto, SqlIdentifierGuardValidationDto, blob/queue/provider guards, …) |
Públicos por necessidade de testes/validators internos — não usar como contrato externo de API |
ETypeLocationSaveFiles / ETypeLocationQueueMessaging |
Local de arquivos / mensageria |
TokenQueryExecutionMode |
Stored procedure vs SQL inline |
Domain — contratos comuns / data / Dapper
| Tipo | Descrição |
|---|---|
IAppLogger / NullAppLogger |
Logger abstrato + no-op |
ICacheProvider / ICacheService |
Contrato de cache host |
ICacheSerializer |
Serialização de payloads de cache |
ICacheMetrics / NullCacheMetrics |
Métricas hit/miss/latência |
IClock / SystemClock |
Relógio abstrato |
ISmartCoreHubMapper |
Mapeamento de objetos |
ISmartCoreHubDataBaseConnectionFactory |
Factory de DbConnection aberta |
IRepositoryImplementationFactory / RepositoryImplementationKind |
Escolha EF vs Dapper |
IErrorGetLocalizationService |
Lookup de erros localizados |
IGenericService<TEntity> |
Contrato CRUD genérico de serviço (implementação fica no host) |
JsonSerializerHelper |
Helpers JSON compartilhados |
ParallelOptionsHelper / ProcessStopwatch / CultureDateTimeHelper |
Helpers diversos |
DatabaseExtensionsHelper |
Helpers de extensão de DB |
Domain — cloud, segurança e auditoria
| Tipo | Descrição |
|---|---|
IBlobStorageAdapter / IBlobStorageAdapterFactory |
Blob storage |
IQueueStorageAdapter / IQueueStorageAdapterFactory |
Queue storage |
ITableStorageAdapter / ITableStorageAdapterFactory |
Table storage |
ICloudServiceFactory |
Contrato de factory cloud (não há implementação pública correspondente neste pacote; use as factories Azure concretas) |
IUserContext / UserContext |
Contexto de usuário |
UserClaimsHelper / ActorContextData |
Claims → ator |
ChangeType |
Tipos de mudança de auditoria |
AuditRegistrationRequestBase<T> / AuditRegistrationRequest / AuditRegistrationTypedRequest<T> |
Requests de auditoria |
IAuditService |
Serviço de auditoria genérico |
RichContentFormat / RichContentSanitizeOptions / IRichContentSanitizer |
Sanitização de conteúdo rich |
RichContentSanitizerHelper / DefaultRichContentSanitizer |
Implementação com HtmlSanitizer (heavy) |
AutoMapperAdapter |
ISmartCoreHubMapper sobre AutoMapper (heavy) |
Infrastructure — cache light (todos os TFMs)
| Tipo | Descrição |
|---|---|
MemoryCacheProvider |
ICacheProvider in-memory |
DiskCacheProvider |
Cache em disco |
SystemTextJsonCacheSerializer |
Serializer System.Text.Json |
CacheStoredEntry |
Envelope armazenado |
CacheMetrics |
Métricas hit/miss/latência — somente net6+ (ausente em netstandard) |
CacheProviderHelperéinternale não faz parte da API pública estável.
Infrastructure — cache heavy (net8/net10)
| Tipo | Descrição |
|---|---|
RedisCacheProvider |
Cache Redis |
MongoDbCacheProvider / MongoCacheDocument |
Cache Mongo |
AzureCosmosDbCacheProvider |
Cache Cosmos DB |
SdkCachingServiceCollectionExtensions.AddSdkCaching() |
Wiring completo de DI do stack de cache |
Infrastructure — repositórios e dados
| Tipo | TFM | Descrição |
|---|---|---|
IGenericRepository<T> |
todos | CRUD genérico para LongEntityBase |
DapperAdpterGenericRepository<T> |
heavy | Implementação Dapper (grafia histórica) |
RepositoryImplementationFactory |
heavy | Resolve EF ou Dapper via DI |
GenericRepository<T> |
heavy | Implementação EF Core |
EfUnitOfWork |
heavy | IUnitOfWork sobre DbContext |
DatabaseDialectResolver |
todos | Detecta dialeto SQL |
DatabaseProviderType / DatabaseProviderResolver |
todos | Provider + resolver |
IDatabaseRoutineDefinition |
todos | Contrato de rotinas de DB |
DatabaseRoutineStateStore |
todos | Estado idempotente de rotinas aplicadas |
DatabaseRoutineConfiguration |
heavy | Aplica rotinas SQL (host fornece a lista) |
HelperCharSet |
heavy | Charset/collation MySQL em configs EF |
EntityTypeConfigurationConstants |
todos | Constantes de tipos de coluna (varchar/text) |
MySqlConnectionPoolingHelper |
todos | Defaults de pooling MySQL em connection strings |
EfDbConnectionFactory<TContext> |
heavy | Factory de DbConnection a partir do provider EF |
Infrastructure — NoSql
| Tipo | TFM | Descrição |
|---|---|---|
ENoSqlProvider |
todos | Mongo / Cosmos / Table (enum); implementação concreta atual: Mongo — Cosmos/Table lançam NotSupportedException |
INoSqlPersistenceAdapter<T,TKey> |
todos | Adapter NoSql genérico |
INoSqlCrudRepository<T,TKey> (+ Factory) |
todos | Contrato CRUD |
NoSqlCrudRepository<T,TKey> (+ Factory) |
todos | Wrapper CRUD padrão |
INoSqlPersistenceAdapterProviderFactory |
heavy | Factory de adapters |
NoSqlPersistenceAdapterProviderFactory |
heavy | Seleciona provider; só Mongo está implementado |
IMongoPersistenceAdapterFactory / MongoPersistenceAdapterFactory |
heavy | Factory Mongo |
MongoPersistenceAdapter<T,TKey> |
heavy | Adapter Mongo |
Infrastructure — Azure (net8/net10)
| Tipo | Descrição |
|---|---|
AzureBlobStorageAdapter / BlobStorageAdapterFactory |
Blob |
AzureQueueStorageAdapter / QueueStorageAdapterFactory |
Queue |
AzureTableStorageAdapter / TableStorageAdapterFactory |
Table |
IAzureTableClient / AzureDataTablesClient |
Cliente Tables testável |
Client.Cloud — HTTP JWT client (net8/net10)
Cliente de aplicativo para a SmartCoreHub.API (Auth + Blob/Queue/Table via REST). Layout alinhado ao Localization.SDK (Abstred / Clients / Configuration / Extensions / Http / Models / Facade).
Não confundir com Infrastructure/Cloud/Azure (*Adapter = SDK Azure in-process). Aqui os tipos são *Client (HTTP).
| Tipo | Namespace | Papel |
|---|---|---|
IAuthClient / AuthClient |
Abstred / Clients |
Login JWT, register, current user |
IBlobStorageClient / BlobStorageClient |
Abstred / Clients |
Upload/download/delete blob via API |
IQueueStorageClient / QueueStorageClient |
Abstred / Clients |
Send/receive queue via API |
ITableStorageClient / TableStorageClient |
Abstred / Clients |
CRUD table via API |
CloudHttpRequestExecutor |
Http |
Base HTTP (ex-BaseHttpService) |
SmartCoreHubOptions |
Configuration |
BaseUrl, timeout, ApiKey |
AddSmartCoreHub(...) |
Extensions |
DI (4 overloads) |
SmartCoreHubApplication |
Facade |
Fachada Auth + storage |
using SmartCoreHub.Core.SDK.Client.Cloud.Configuration;
using SmartCoreHub.Core.SDK.Client.Cloud.Extensions;
services.AddSmartCoreHub(new SmartCoreHubOptions
{
BaseUrl = "https://api.exemplo/"
});
// Resolve IAuthClient, IBlobStorageClient, etc.
O módulo Client/Cloud/ é autocontido (sem dependência de Cloud.Azure) e pode ser extraído no futuro para um NuGet irmão com troca mínima de namespaces.
Infrastructure — security / logging
| Tipo | Descrição |
|---|---|
IPasswordHasher |
Contrato de hash |
BcryptPasswordHasher / HmacSha512PasswordHasher |
Implementações |
PasswordHasherFactory / PasswordAlgorithm |
Factory / enum |
ISecurityTokenAdapter / ISecurityTokenAdapterFactory |
Contratos de token |
JwtTokenAdapter / SecurityTokenAdapterFactory |
Implementação JWT (heavy). Atenção: ValidateToken / GetPrincipalFromExpiredToken usam ValidateIssuer=false e ValidateAudience=false (validam a signing key). Reavalie antes de uso multi-tenant ou internet-facing |
SerilogAdapter |
IAppLogger sobre Serilog (heavy) |
Application.Cqrs — contratos, pipeline e factories (net8/net10)
| Tipo | Métodos / membros | Descrição |
|---|---|---|
ICommand<TResult> / IQuery<TResult> |
— | Marcadores de request |
ICommandHandler<TCommand,TResult> / IQueryHandler<TQuery,TResult> |
HandleAsync |
Handlers |
IApplicationDispatcher |
SendAsync, QueryAsync |
Borda HTTP/composition — não usar IMediator |
IApplicationBehavior<TRequest,TResult> |
HandleAsync, Order |
Behavior do pipeline |
IHasValidationPayload<TPayload> |
Payload |
Opt-in validação |
ITransactionalCommand |
— | Opt-in transação |
ICacheableQuery |
— | Contrato futuro (CachingBehavior ainda não ativo) |
ApplicationPipeline<TRequest,TResult> |
ExecuteAsync |
Orquestra behaviors |
ApplicationBehaviorOrders |
UnhandledException=100 … Caching=600 |
Ordens canônicas |
LoggingBehavior / PerformanceBehavior / TransactionBehavior / UnhandledExceptionBehavior |
HandleAsync |
Behaviors genéricos |
PerformanceBehaviorOptions |
threshold config | Tuning de warning |
ServiceResponseFactory |
Validation, Unauthorized, Forbidden, NotFound, Conflict, Business, ExternalUnavailable, Internal |
Envelopes sanitizados (sem stack/FullMessage) |
MediatRApplicationDispatcher |
implementa dispatcher | Adapter MediatR |
AddSmartCoreHubMediatRAdapter(...) |
2 overloads | DI CQRS |
ITransactionExecutor / NoOpTransactionExecutor |
BeginAsync, CommitAsync, RollbackAsync |
Transações |
SmartCoreHubActivitySources |
Cqrs, Mcp, *Name / *MeterName |
ActivitySource + meters |
Pipeline efetivo: UnhandledException → Logging → Performance → Validation → Transaction → Handler.
Service.Hosting — OpenTelemetry, HttpClient, health (net8/net10)
| Tipo | Métodos | Descrição |
|---|---|---|
OpenTelemetryExtensions |
AddSmartCoreHubOpenTelemetry<TBuilder> |
OTLP + ASP.NET/HttpClient/EF + sources SDK |
OpenTelemetryHostingOptions |
endpoint/protocol options | Config OTEL |
OpenTelemetryHostingOptionsValidator |
Validate |
Validação de options |
HttpClientDefaultsExtensions |
AddSmartCoreHubHttpClientDefaults<TBuilder> |
Service discovery + resilience padrão |
ConditionalHealthCheckExtensions |
AddSmartCoreHubDatabaseReadinessCheck<TContext>, AddSmartCoreHubRedisReadinessCheckIfEnabled |
Health checks condicionais |
DbContextConnectivityHealthCheck<TContext> |
CheckHealthAsync |
CanConnect |
RedisMultiplexerHealthCheck |
CheckHealthAsync |
Redis |
ReadinessHostingOptions |
flags de readiness | Config |
Domain — helpers e extensions (métodos)
| Tipo | Métodos |
|---|---|
Guard |
AgainstNull, AgainstEmptyString, AgainstNegative |
Result / Result<T> |
Success, Failure; props IsSuccess, Errors |
StringHelper / StringExtensions |
NormalizeText, Slugify, ToSnakeCase, ToCamelCase, ToPascalCase, Truncate, MaskDocument |
DateTimeHelper / DateTimeExtensions |
ToUserTimeZone, StartOfDay, EndOfDay, CalculateAge, AddBusinessDays |
CultureDateTimeHelper |
GetCultures |
JsonSerializerHelper |
ToUtf8Bytes |
ParallelOptionsHelper |
GetParallelOptions |
ProcessStopwatch |
medição de duração |
UserClaimsHelper |
TryGetUserId, TryGetEmail, GetUserIdOrDefault, GetEmailOrEmpty, GetClaimValueOrEmpty, GetActorDisplayNameOrEmpty, TryGetApplicationId, GetRoles, … |
| Exceptions | SmartCoreHubSdkException, BusinessException, ValidationException, NotFoundException, ConflictException, UnauthorizedException, ForbiddenException, ConfigurationException, ExternalServiceException |
Contratos com superfície completa de métodos
| Contrato | Métodos |
|---|---|
ICacheProvider |
TryGetAsync, GetAsync, SetAsync, RemoveAsync, ExistsAsync, GetOrSetAsync |
IGenericRepository<T> |
AddAsync, UpdateAsync, DeleteAsync, SoftDeleteAsync, GetByIdAsync, GetAllAsync, GetActiveAsync, FindAsync, FindFirstAsync, GetPagedAsync, ExistsAsync, CountAsync, ActivateAsync, DeactivateAsync, BulkAddAsync, BulkUpdateAsync, BulkDeleteAsync, BulkSoftDeleteAsync, AddOrUpdateAsync |
ServiceResponse<T> |
Ok, Error, UnauthorizedResponse, Paged |
BaseApiController |
GetApplicationIdFromClaims, SetApplicationIdOnUserContext, CurrentUserContext, CurrentApiKeyUserContext, GetApplicationIp, IsUserAuthenticated, GetUserRoles, ErrorResponse, LogError |
IJwtAccessTokenService / JwtAccessTokenService |
GenerateAccessToken, GenerateRefreshToken, TryGetUserId, BuildStandardAccessClaims |
TokenHelper |
TryParseToken, ComputeHash, GeneratePrefix, GenerateSecret, GenerateSalt, FixedTimeEquals |
AddSdkCorePrimitives |
registra IClock/SystemClock e opcionalmente NullAppLogger |
AspNetCoreApiBasicsExtensions |
AddAspNetCoreApiBasics, AddHttpContextUserContextAccessor |
DatabaseReadinessExtensions |
MapDatabaseReadiness<TContext>, ResolveReadinessAsync<TContext>, ResolveReadiness<TContext> |
Client.Cloud — models (net8/net10)
| Tipo | Papel |
|---|---|
LoginRequest / LoginResponse / RegisterRequest / UserModel / UpdateUserRequest / ChangePasswordRequest |
Auth |
ApiResponse / ApiResponse<T> |
Envelope HTTP do client |
BlobUploadResult, requests/results de blob/queue/table em StorageModels |
Storage via API |
AuthClient |
LoginAsync, RegisterAsync, GetCurrentUserAsync, LogoutAsync, SetAccessToken, ClearAccessToken |
BlobStorageClient |
UploadBlobAsync, DownloadBlobAsync, DownloadBlobStreamAsync, BlobExistsAsync, DeleteBlobAsync, CreateContainerAsync, … |
QueueStorageClient |
SendMessageAsync, GetQueueLengthAsync, CreateQueueAsync, DeleteQueueAsync, QueueExistsAsync, … |
TableStorageClient |
InsertEntityAsync, UpsertEntityAsync, UpdateEntityAsync, DeleteEntityAsync, … |
SmartCoreHubApplication |
Fachada: Auth, BlobStorage, QueueStorage, TableStorage; LoginAsync, LogoutAsync, IsApiAccessibleAsync, … |
Exemplos adicionais
Result e Guard
using SmartCoreHub.Core.SDK.Domain.Common;
using SmartCoreHub.Core.SDK.Domain.Validation;
public Result<string> Normalize(string input)
{
Guard.AgainstEmptyString(input, nameof(input));
return Result.Success(input.Trim());
}
Cache Memory
using SmartCoreHub.Core.SDK.Infrastructure.Caching.Providers;
using Microsoft.Extensions.Caching.Memory;
services.AddMemoryCache();
services.AddSingleton<ICacheProvider, MemoryCacheProvider>();
Repositório Dapper ou EF (net8/net10)
using SmartCoreHub.Core.SDK.Dapper.Generic;
using SmartCoreHub.Core.SDK.EntityFrameworkCore.Repositories;
using SmartCoreHub.Core.SDK.Infrastructure.Repositories.Generic;
// EF
services.AddScoped(typeof(IGenericRepository<>), typeof(GenericRepository<>));
// Dapper open-generic
services.AddScoped(typeof(DapperAdpterGenericRepository<>));
Entidades usam LongEntityBase (long Id). Construtor Dapper: ISmartCoreHubDataBaseConnectionFactory, IAppLogger, string? tableName.
Azure Blob factory (net8/net10)
using SmartCoreHub.Core.SDK.Cloud.Azure;
using SmartCoreHub.Core.SDK.Domain.Interfaces.Cloud;
services.AddScoped<IBlobStorageAdapterFactory, BlobStorageAdapterFactory>();
O que permanece no host (não está neste pacote)
| Item | Onde fica | Motivo |
|---|---|---|
GenericService<TEntity> |
SmartCoreHub.Service |
FluentValidation + validators de feature |
ApiKeyAuthenticationHandler |
SmartCoreHub.Service |
Acoplado a serviços/repositórios de domínio |
JwtTokenService (User → claims) |
SmartCoreHub.Service |
Adapter de domínio sobre IJwtAccessTokenService |
SmartCoreHubDocumentationOptions |
SmartCoreHub.Service |
Branding (títulos, e-mail, policy AllowAngularApp) |
WebApplicationBuilderServicesConfigure / WebApplicationExtensions |
SmartCoreHub.Service |
Fachadas estáveis de composição do monólito |
SmartCoreHubHostServiceCollectionExtensions / SmartCoreHubPipelineExtensions |
SmartCoreHub.Service |
Agrupamento por categoria e ordem canônica do produto |
ValidationServiceCollectionExtensions / ProductOptionsServiceCollectionExtensions |
SmartCoreHub.Service |
FluentValidation e options específicas do produto |
SmartCoreHubDatabaseStartupExtensions |
SmartCoreHub.Service |
Migrations e rotina GetActiveNonExpiredTokens |
| DbContext / migrations / entidades | SmartCoreHub.Infrastructure |
Persistência específica do produto |
| Controllers de feature | APIs | Host |
Constraints e breaking changes
- Generics EF/Dapper exigem
where TEntity : LongEntityBase. - Nomes históricos mantidos:
DapperAdpterGenericRepository,CloudRessource. - Cascas Obsolete em Domain/Infrastructure foram removidas. Use tipos deste pacote no monólito/host.
- Wrappers Service de documentação/CORS/performance foram removidos — chame
SmartCoreHub.Core.SDK.Service.API.DI.*diretamente. - Application Insights é condicional: sem connection string/instrumentation key,
AddApplicationInsightsIfConfigured()não registra telemetria. - Forwarded Headers deve receber proxies/redes confiáveis em ambientes não Development; não torne a configuração permissiva em produção.
AddFileSystemDataProtection()cria o diretório do key ring. Em contêiner, monte volume persistente para evitar perda das chaves.SmartCoreHub.Localization.SDKé auto-isolado: não depende deste NuGet; contratos HTTP/cache leves do Localization são cópia owned.- Um único
PackageId=SmartCoreHub.Core.SDK— não existem pacotes companheiros.Dapper/.Caching.*/.Cloud.Azure. - Tipos em namespaces/
Internal(ex.:SqlIdentifierRegexHelper, DTOs de guarda) podem serpublicpor necessidade técnica — trate-os como API instável. AddCustomOpenApi/ documento nativo/openapi/v1.jsonexigem net10; em net8 use Swagger JSON.
Documentação relacionada
- Requisitos / escopo / Extensões IDE: Documentation/Features/SmartCoreHub.Core.SDK-Extensões-IDE/SmartCoreHub.Core.SDK-Extensões-IDE-Requisitos.md
- Guia de migração: MIGRATION-GUIDE.md
- Catálogo completo da API: API-CATALOG.md
- Contexto IA: AI-CONTEXT.md
- Extensões IDE (projeto separado): ../SmartCoreHub.Core.SDK.Extensions/README.md
- Publicação nas stores: ../SmartCoreHub.Core.SDK.Extensions/docs/BUILD-DEPLOY-PUBLISH.md
- Instalação manual: ../SmartCoreHub.Core.SDK.Extensions/docs/INSTALL-MANUAL.md
- Service → Core — extração ASP.NET
- Extração de pendências
- Remoção de shims
- Isolamento Localization.SDK
- UIs de documentação das APIs
- Survey da refatoração DI/pipeline
- NuGet Gallery: https://www.nuget.org/packages/SmartCoreHub.Core.SDK/
Desenvolvimento local (repositório)
cd backend
dotnet build Core\SmartCoreHub.Core.SDK\SmartCoreHub.Core.SDK.csproj -c Release
dotnet test Core\SmartCoreHub.Core.SDK.Tests\SmartCoreHub.Core.SDK.Tests.csproj -c Release
dotnet pack Core\SmartCoreHub.Core.SDK\SmartCoreHub.Core.SDK.csproj -c Release
Licença
Consulte o arquivo LICENSE incluído no pacote NuGet.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- BCrypt.Net-Next (>= 4.2.1)
- Microsoft.Extensions.Caching.Memory (>= 10.0.10)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
- System.Text.Json (>= 10.0.10)
-
.NETStandard 2.1
- BCrypt.Net-Next (>= 4.2.1)
- Microsoft.Extensions.Caching.Memory (>= 10.0.10)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
- System.Text.Json (>= 10.0.10)
-
net10.0
- AutoMapper (>= 16.2.0)
- Azure.Data.Tables (>= 12.11.0)
- Azure.Identity (>= 1.21.0)
- Azure.Storage.Blobs (>= 12.29.1)
- Azure.Storage.Queues (>= 12.27.1)
- BCrypt.Net-Next (>= 4.2.1)
- Dapper (>= 2.1.79)
- HtmlSanitizer (>= 9.1.949-beta)
- IGeekFan.AspNetCore.RapiDoc (>= 0.0.10)
- MediatR (>= 12.5.0)
- Microsoft.ApplicationInsights (>= 3.1.2)
- Microsoft.ApplicationInsights.AspNetCore (>= 3.1.2)
- Microsoft.AspNetCore.OpenApi (>= 10.0.10)
- Microsoft.Azure.Cosmos (>= 3.62.0)
- Microsoft.EntityFrameworkCore (>= 9.0.18)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.18)
- Microsoft.Extensions.Http.Resilience (>= 10.8.0)
- Microsoft.Extensions.ServiceDiscovery (>= 10.8.0)
- Microsoft.IdentityModel.Tokens (>= 8.19.2)
- MongoDB.Driver (>= 3.10.0)
- Newtonsoft.Json (>= 13.0.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.17.0)
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.17.0)
- OpenTelemetry.Instrumentation.EntityFrameworkCore (>= 1.17.0-beta.1)
- OpenTelemetry.Instrumentation.Http (>= 1.17.0)
- Polly (>= 8.7.0)
- Scalar.AspNetCore (>= 2.16.15)
- Serilog (>= 4.4.0)
- SharpCompress (>= 0.50.0)
- Snappier (>= 1.3.1)
- StackExchange.Redis (>= 3.0.17)
- Swashbuckle.AspNetCore (>= 10.2.3)
- Swashbuckle.AspNetCore.ReDoc (>= 10.2.3)
- System.IdentityModel.Tokens.Jwt (>= 8.19.2)
-
net6.0
- BCrypt.Net-Next (>= 4.2.1)
- Microsoft.Extensions.Caching.Memory (>= 10.0.10)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
- System.Text.Json (>= 10.0.10)
-
net8.0
- AutoMapper (>= 16.2.0)
- Azure.Data.Tables (>= 12.11.0)
- Azure.Identity (>= 1.21.0)
- Azure.Storage.Blobs (>= 12.29.1)
- Azure.Storage.Queues (>= 12.27.1)
- BCrypt.Net-Next (>= 4.2.1)
- Dapper (>= 2.1.79)
- HtmlSanitizer (>= 9.1.949-beta)
- IGeekFan.AspNetCore.RapiDoc (>= 0.0.10)
- MediatR (>= 12.5.0)
- Microsoft.ApplicationInsights (>= 3.1.2)
- Microsoft.ApplicationInsights.AspNetCore (>= 3.1.2)
- Microsoft.Azure.Cosmos (>= 3.62.0)
- Microsoft.EntityFrameworkCore (>= 9.0.18)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.18)
- Microsoft.Extensions.Caching.Memory (>= 10.0.10)
- Microsoft.Extensions.Configuration (>= 10.0.10)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Http.Resilience (>= 10.8.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
- Microsoft.Extensions.ServiceDiscovery (>= 10.8.0)
- Microsoft.IdentityModel.Tokens (>= 8.19.2)
- MongoDB.Driver (>= 3.10.0)
- Newtonsoft.Json (>= 13.0.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.17.0)
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.17.0)
- OpenTelemetry.Instrumentation.EntityFrameworkCore (>= 1.17.0-beta.1)
- OpenTelemetry.Instrumentation.Http (>= 1.17.0)
- Polly (>= 8.7.0)
- Scalar.AspNetCore (>= 2.16.15)
- Serilog (>= 4.4.0)
- SharpCompress (>= 0.50.0)
- Snappier (>= 1.3.1)
- StackExchange.Redis (>= 3.0.17)
- Swashbuckle.AspNetCore (>= 10.2.3)
- Swashbuckle.AspNetCore.ReDoc (>= 10.2.3)
- System.IdentityModel.Tokens.Jwt (>= 8.19.2)
- System.Text.Json (>= 10.0.10)
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 |
|---|---|---|
| 20260725.502.0 | 0 | 7/25/2026 |
| 20260722.2120.0 | 38 | 7/22/2026 |
| 20260719.2245.0 | 54 | 7/19/2026 |
| 20260718.424.0 | 87 | 7/18/2026 |
| 20260717.2036.0 | 91 | 7/17/2026 |
| 20260717.1614.0 | 90 | 7/17/2026 |
| 20260717.454.0 | 93 | 7/17/2026 |
| 20260714.2141.0 | 89 | 7/14/2026 |
| 20260624.159.0 | 113 | 6/24/2026 |
| 20260608.447.0 | 103 | 6/8/2026 |