SmartCoreHub.Core.SDK 20260714.2141.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SmartCoreHub.Core.SDK --version 20260714.2141.0
                    
NuGet\Install-Package SmartCoreHub.Core.SDK -Version 20260714.2141.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SmartCoreHub.Core.SDK" Version="20260714.2141.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmartCoreHub.Core.SDK" Version="20260714.2141.0" />
                    
Directory.Packages.props
<PackageReference Include="SmartCoreHub.Core.SDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SmartCoreHub.Core.SDK --version 20260714.2141.0
                    
#r "nuget: SmartCoreHub.Core.SDK, 20260714.2141.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SmartCoreHub.Core.SDK@20260714.2141.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SmartCoreHub.Core.SDK&version=20260714.2141.0
                    
Install as a Cake Addin
#tool nuget:?package=SmartCoreHub.Core.SDK&version=20260714.2141.0
                    
Install as a Cake Tool

SmartCoreHub.Core.SDK

Biblioteca NuGet central do SmartCoreHub: primitivas de dominio, Result/Guard, contratos de cache/NoSql/cloud, helpers e — nos TFMs modernos — implementacoes reutilizaveis de repositorios genericos (EF Core / Dapper), providers de cache (Redis, Mongo, Cosmos, Disk) e adapters Azure.

Use este pacote quando precisar da mesma fonte de contratos e implementacoes genericas entre APIs, hosts .NET e SDKs que optarem por referenciar o Core.

Localization.SDK: pacote publico auto-isolado — nao depende deste Core no NuGet. Tipos HTTP/cache leves usados pelo Localization sao copia owned. Ver Isolamento-Core.md.

Instalacao

dotnet add package SmartCoreHub.Core.SDK
<PackageReference Include="SmartCoreHub.Core.SDK" Version="*" />

Frameworks suportados

TFM Tipos leves (contratos, Result, Memory/Disk cache, helpers) Tipos pesados (Dapper, EF, Redis, Mongo, Cosmos, Azure)
netstandard2.0 Sim Nao
netstandard2.1 Sim Nao
net6.0 Sim Nao
net8.0 Sim Sim
net10.0 Sim Sim

Dependencias pesadas (Dapper, EF Core, StackExchange.Redis, MongoDB.Driver, Azure SDKs, etc.) entram no grafo NuGet somente quando o projeto consumidor tem como alvo net8.0 ou net10.0.

Light vs heavy

  • Light: disponibilizado em todos os TFMs — Domain (interfaces/DTOs/entidades base), Others (Result, Guard, exceptions, HTTP leve), cache Memory/Disk, abstracoes NoSql, password hashers, helpers de Service.
  • Heavy (net8/net10): DapperAdpterGenericRepository<T>, GenericRepository<T> (EF), factories/adapters Azure, providers Redis/Mongo/Cosmos, adapters Mongo NoSql.

CacheFactory (namespace Service) cria apenas o provider Memory. Em produção, registre Redis/Disk/Mongo/Cosmos diretamente pelos tipos deste pacote (ou via DI do host SmartCoreHub).

Mapa de namespaces

Namespace Conteudo tipico
SmartCoreHub.Core.SDK.Others.* Result, Guard, exceptions, ValueObject, HTTP leve, cache leve Guid
SmartCoreHub.Core.SDK.Domain.* Entidades base, DTOs, enums, interfaces (cache, cloud, data, Dapper)
SmartCoreHub.Core.SDK.Infrastructure.* Cache light, dialect/resolvers, password hashers, NoSql abstrato
SmartCoreHub.Core.SDK.Dapper.Generic / .Persistence Repositorio Dapper + factory (heavy)
SmartCoreHub.Core.SDK.EntityFrameworkCore[.Repositories] GenericRepository<T>, EfUnitOfWork (heavy)
SmartCoreHub.Core.SDK.Caching.{Redis,Mongo,Cosmos} Providers de cache pesados
SmartCoreHub.Core.SDK.NoSql.Mongo.* Adapters Mongo (heavy)
SmartCoreHub.Core.SDK.Cloud.Azure Blob/Queue/Table adapters e factories (heavy)
SmartCoreHub.Core.SDK.Service.* ServiceResult, TokenHelper, IpAddressHelper, config/headers

Layout em disco: pastas Domain/, Infrastructure/, Service/ e Others/ (tipos nativos do SDK; ver Others/README.md).


Catalogo reutilizavel

Cada tipo publico listado abaixo pode ser reutilizado por consumidores do pacote. Tipos em pastas Internal nao devem ser dependencia estavel (exceto onde indicado).

Others — Result, validacao e exceptions

Tipo Descricao
Result / Result<T> Padrao Result (sucesso/falha)
Error Erro tipado usado com Result
PaginatedResult<T> Envelope de pagina
Guard Guards de argumento
SmartCoreHubSdkException Exception base do SDK
BusinessException Regra de negocio
NotFoundException Recurso nao encontrado
ConflictException Conflito de estado
ForbiddenException Sem permissao
UnauthorizedException Nao autenticado
ValidationException Falha de validacao
ConfigurationException Config invalida
ExternalServiceException Falha de servico externo
StringHelper / StringExtensions Utilitarios de string
DateTimeHelper / DateTimeExtensions Utilitarios de data/hora
ValueObject Base de equality estrutural para VOs

Others — repositorio Guid e cache leve

Tipo Descricao
IUnitOfWork Unidade de trabalho
IRepository<T> / IReadRepository<T> Contratos Guid-based
ILightweightCacheProvider Cache leve (sem ICacheProvider host)
LightweightMemoryCacheProvider Implementacao Memory para SDKs de feature

Others — HTTP / headers

Tipo Descricao
HttpRequestExecutorBase Base de executor HTTP
HttpExecutionResult<T> Resultado de chamada HTTP
IAuthHeaderProvider Provedor de headers de autenticacao
IApiErrorMapper Mapeamento de erros de API
ApiKeyAuthHeaderProvider / ApiKeyAuthOptions API key em header
AcceptLanguageHelper Parsing Accept-Language
Headers Constantes de headers HTTP

Domain — entidades e value objects

Tipo Descricao
IEntity Marcador de entidade
EntityBase Entidade com Guid Id
AuditableEntity Entidade com campos de auditoria
LongEntityBase Entidade com long Id (generics EF/Dapper)
Email / Role / ConnectionString Value objects
CloudProvider / CloudRessource Enums de nuvem (grafia historica mantida)

Domain — enums e DTOs

Tipo Descricao
ECacheProvider / ETypeLocationCache Providers / localizacao de cache
DatabaseDialect SQL Server / MySQL / PostgreSQL
BaseSearchDto DTO base de busca/paginacao
CacheConfigurationDto Secao raiz de configuracao de cache
CacheEntryOptions / CacheLoggingOptions Opcoes de entrada e logging
CacheProviderOptions (+ Memory/Redis/Disk/MongoDb/AzureCosmosDb) Opcoes por provider
IServiceResponse<T> / ServiceResponse<T> Envelope de resposta de servico
CultureDisplayDto Exibicao de cultura
ITokenConfigurationDto / TokenConfigurationDto Configuracao de token

Domain — contratos comuns / data / Dapper

Tipo Descricao
IAppLogger / NullAppLogger Logger abstrato + no-op
ICacheProvider / ICacheService Contrato de cache host
ICacheSerializer Serializacao de payloads de cache
ICacheMetrics / NullCacheMetrics Metricas hit/miss/latencia
IClock / SystemClock Relogio abstrato
ISmartCoreHubMapper Mapeamento de objetos
ISmartCoreHubDataBaseConnectionFactory Factory de DbConnection aberta
IRepositoryImplementationFactory / RepositoryImplementationKind Escolha EF vs Dapper
IErrorGetLocalizationService Lookup de erros localizados
JsonSerializerHelper Helpers JSON compartilhados
ParallelOptionsHelper / ProcessStopwatch / CultureDateTimeHelper Helpers diversos
DatabaseExtensionsHelper Helpers de extensao de DB

Domain — cloud e seguranca

Tipo Descricao
IBlobStorageAdapter / IBlobStorageAdapterFactory Blob storage
IQueueStorageAdapter / IQueueStorageAdapterFactory Queue storage
ITableStorageAdapter / ITableStorageAdapterFactory Table storage
ICloudServiceFactory Factory de servicos cloud
IUserContext / UserContext Contexto de usuario
UserClaimsHelper / ActorContextData Claims → ator
ChangeType Tipos de mudanca de auditoria
AuditRegistrationRequestBase<T> / AuditRegistrationRequest / AuditRegistrationTypedRequest<T> Requests de auditoria
IAuditService Servico de auditoria generico
RichContentFormat / RichContentSanitizeOptions / IRichContentSanitizer Sanitizacao de conteudo rich

Infrastructure — cache light (todos os TFMs)

Tipo Descricao
MemoryCacheProvider ICacheProvider in-memory
DiskCacheProvider Cache em disco
SystemTextJsonCacheSerializer Serializer System.Text.Json
CacheStoredEntry Envelope armazenado
CacheProviderHelper Helpers compartilhados
CacheMetrics Metricas (net6+)

Infrastructure — cache heavy (net8/net10)

Tipo Descricao
RedisCacheProvider Cache Redis
MongoDbCacheProvider / MongoCacheDocument Cache Mongo
AzureCosmosDbCacheProvider Cache Cosmos DB

Infrastructure — repositorios e dados

Tipo TFM Descricao
IGenericRepository<T> todos CRUD generico para LongEntityBase
DapperAdpterGenericRepository<T> heavy Implementacao Dapper (grafia historica)
RepositoryImplementationFactory heavy Resolve EF ou Dapper via DI
GenericRepository<T> heavy Implementacao EF Core
EfUnitOfWork heavy IUnitOfWork sobre DbContext
DatabaseDialectResolver todos Detecta dialeto SQL
DatabaseProviderType / DatabaseProviderResolver todos Provider + resolver
IDatabaseRoutineDefinition todos Contrato de rotinas de DB

Infrastructure — NoSql

Tipo TFM Descricao
ENoSqlProvider todos Mongo / Cosmos / Table
INoSqlPersistenceAdapter<T,TKey> todos Adapter NoSql generico
INoSqlCrudRepository<T,TKey> (+ Factory) todos Contrato CRUD
NoSqlCrudRepository<T,TKey> (+ Factory) todos Wrapper CRUD padrao
INoSqlPersistenceAdapterProviderFactory heavy Factory de adapters
NoSqlPersistenceAdapterProviderFactory heavy Implementacao
IMongoPersistenceAdapterFactory / MongoPersistenceAdapterFactory heavy Factory Mongo
MongoPersistenceAdapter<T,TKey> heavy Adapter Mongo

Infrastructure — Azure (net8/net10)

Tipo Descricao
AzureBlobStorageAdapter / BlobStorageAdapterFactory Blob
AzureQueueStorageAdapter / QueueStorageAdapterFactory Queue
AzureTableStorageAdapter / TableStorageAdapterFactory Table
IAzureTableClient / AzureDataTablesClient Cliente Tables testavel

Infrastructure — security

Tipo Descricao
IPasswordHasher Contrato de hash
BcryptPasswordHasher / HmacSha512PasswordHasher Implementacoes
PasswordHasherFactory / PasswordAlgorithm Factory / enum
ISecurityTokenAdapter / ISecurityTokenAdapterFactory Contratos de token

Service

Tipo Descricao
ServiceResult / ServiceResult<T> / ServiceResultHelper Resultado de servico de aplicacao
IpAddressHelper IP do cliente
TokenHelper Helpers de API key / token
ApiKeyAuthenticationSettings Settings de API key
AppConfigConstants / ConfigurationHelper Constantes e helpers de config
HttpHeaderNamesHelper Nomes de headers
CacheFactory Factory Memory-only (legado)
ValidationFailure / ValidationErrorMapper Mapeamento de erros de validacao

Exemplos

Result e Guard

using SmartCoreHub.Core.SDK.Others.Common;
using SmartCoreHub.Core.SDK.Others.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>();

Repositorio 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>();

Constraints e breaking changes

  • Generics EF/Dapper exigem where TEntity : LongEntityBase.
  • Nomes historicos mantidos: DapperAdpterGenericRepository, CloudRessource.
  • Cascas Obsolete em Domain/Infrastructure foram removidas. Use tipos deste pacote no monólito/host.
  • SmartCoreHub.Localization.SDK e auto-isolado: nao depende deste NuGet; contratos HTTP/cache leves do Localization sao copia owned (nao usar Core types ao consumir Localization).
  • Um unico PackageId=SmartCoreHub.Core.SDK — nao existem pacotes companheiros .Dapper / .Caching.* / .Cloud.Azure.

Desenvolvimento local (repositorio)

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

Licenca

Consulte o arquivo LICENSE incluido no pacote NuGet.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
20260802.156.0 55 8/2/2026
20260731.413.0 48 7/31/2026
20260727.438.0 53 7/27/2026
20260725.502.0 56 7/25/2026
20260722.2120.0 63 7/22/2026
20260719.2245.0 57 7/19/2026
20260718.424.0 89 7/18/2026
20260717.2036.0 92 7/17/2026
20260717.1614.0 93 7/17/2026
20260717.454.0 95 7/17/2026
20260714.2141.0 90 7/14/2026
20260624.159.0 117 6/24/2026
20260608.447.0 105 6/8/2026