Skip to content

Package Catalog

Section: 16 — Packages
Last Updated: 2026-05-30
Scope: All 16 NuGet packages, key classes, services, what each provides


Group 1: Shared Foundation (Tier 1)

Microtec.Domain

Purpose: Core domain building blocks — zero external dependencies.

CategoryWhat's Included
Base entitiesBaseEntity, AggregateRoot, AuditableEntity, TenantEntity
InterfacesITenantProvider, IClockService, ICurrentUserService, IScopedService, ITransientService, ISingletonService
Value objectsMoney, Address, PhoneNumber, EmailAddress
Result patternResult<T>, Result, Error, ErrorType
ExceptionsDomainException, NotFoundException, ValidationException, ForbiddenException
EnumsEntityStatus, AuditAction
ExtensionsStringExtensions, DateTimeExtensions, GuidExtensions

Key patterns:

csharp
// All entities inherit from BaseEntity
public abstract class BaseEntity
{
    public Guid Id { get; protected set; } = Guid.NewGuid();
}

// Multi-tenant entities inherit TenantEntity
public abstract class TenantEntity : AuditableEntity
{
    public string TenantId { get; set; } = default!;
}

// Service marker interfaces for DI auto-registration
public interface IScopedService { }
public interface ITransientService { }
public interface ISingletonService { }

Microtec.Contracts

Purpose: CQRS contracts, integration events, shared DTOs — the messaging language of the platform.

CategoryWhat's Included
CQRSICommand, ICommand<T>, IQuery<T>, ICommandHandler<T>, IQueryHandler<T,R>
ResponseAPIResponse<T>, PagedResult<T>, PaginationMeta, ValidationError
Integration eventsIIntegrationEvent, IntegrationEventBase
DTOsPagedRequest, DropdownDto, AuditDto, IdNameDto
Events (25+)See integration events section below

Key integration events:

EventPublisherConsumer
TenantCreatedEventBusinessOwnersAll services (seeding)
TenantDeletedEventBusinessOwnersAll services (cleanup)
EmployeeCreatedEventHRNotification, Workflow
InvoiceApprovedEventAccountingIntegration, Notification
WorkflowCompletedEventWorkflowAll services
UserProvisionedEventBusinessOwnersKeycloak, HR
AttachmentUploadedEventAttachmentAll services
ImportCompletedEventImportOriginating service

Group 2: Shared Infrastructure (Tier 2)

Microtec.Persistence

Purpose: EF Core infrastructure — repositories, unit of work, interceptors, multi-tenancy.

CategoryWhat's Included
RepositoryRepositoryBase<T>, IRepository<T>, IReadRepository<T>
Unit of WorkIUnitOfWork<TContext>, UnitOfWorkBase<TContext>, IAdminUnitOfWork
InterceptorsAuditInterceptor, SoftDeleteInterceptor
EF ExtensionsConfigureAuditFields(), ConfigureSoftDelete(), ConfigureMultiTenancy(), ConfigureDecimalPrecision(), ApplyGlobalQueryFilters()
SpecificationsISpecification<T>, SpecificationEvaluator, BaseSpecification<T>
Multi-tenancyTenantDbContextFactory, ITenantConnectionStringResolver

See ef-core-patterns.md for full usage.


Microtec.Messaging

Purpose: MassTransit abstraction for Azure Service Bus and Redis.

CategoryWhat's Included
PublishersIEventPublisher, ICommandPublisher, EventPublisher
ConsumersIIntegrationEventHandler<T>, ConsumerBase<T>
RedisIDistributedCacheService, ICacheKeyBuilder, RedisDistributedCache
OutboxIOutboxService, OutboxMessage, OutboxProcessor
ConfigurationAddMicrotecMessaging(), AddMicrotecRedis()

Usage:

csharp
// Program.cs
builder.Services.AddMicrotecMessaging(builder.Configuration, busConfig =>
{
    busConfig.AddConsumer<EmployeeCreatedEventHandler>();
    busConfig.AddConsumer<InvoiceApprovedEventHandler>();
});

// Publishing an event
await _eventPublisher.PublishAsync(new EmployeeCreatedEvent(employee.Id, employee.TenantId));

Microtec.Keycloak

Purpose: Keycloak admin API client and provisioning helpers.

CategoryWhat's Included
Admin clientIKeycloakAdminClient, KeycloakAdminClient
ProvisioningIKeycloakProvisioningService, RealmProvisioner, UserProvisioner
TokenITokenIntrospectionService, KeycloakTokenValidator
ModelsRealmRepresentation, UserRepresentation, ClientRepresentation
FlowFlowPriority constants (MAC=10, Cookie=20, IdP=30)

Microtec.PublicApi

Purpose: Typed HTTP clients for inter-service communication.

Client InterfaceDownstream Service
IAccountingPublicApiAppsPortal.Apis (Accounting)
IHrPublicApiHR.Apis
IInventoryPublicApiInventory.Apis
IWorkflowPublicApiWorkflows.Apis
IAttachmentPublicApiAttachment.Apis
INotificationPublicApiNotification.Apis

Usage:

csharp
// Program.cs
builder.Services.AddMicrotecPublicApis(builder.Configuration);

// In a handler
public class GetEmployeeWithPayrollHandler
{
    private readonly IAccountingPublicApi _accountingApi;

    public async Task<EmployeePayrollDto> Handle(GetEmployeePayrollQuery query)
    {
        var payrollInfo = await _accountingApi.GetEmployeePayroll(query.EmployeeId);
        return payrollInfo;
    }
}

Internal calls use the X-Api-Key header: 3bb564df-0f24-4ea6-82c1-d99f368cac8a.


Microtec.Reporting

Purpose: Report generation engine — PDF, Excel output from templates.

CategoryWhat's Included
EngineIReportingService, ReportingService
TemplatesIReportTemplate, ReportTemplateBase
RenderersPdfRenderer, ExcelRenderer
ModelsReportRequest, ReportResult, ReportColumn

Microtec.Attachment.Client

Purpose: HTTP client for the Attachment microservice.

What's Included
IAttachmentClient — upload, download, delete files
AttachmentDto, UploadRequest, DownloadResult
AddAttachmentClient() extension

Microtec.Notifications.Client

Purpose: HTTP client for the Notification microservice.

What's Included
INotificationClient — send email, SMS, push
NotificationRequest, EmailNotification, SmsNotification
AddNotificationClient() extension

Group 3: Web Layer (Tier 3)

Microtec.Web.Core

Purpose: ASP.NET Core middleware, JWT auth, localization, error handling.

CategoryWhat's Included
AuthAddMicrotecAuthentication(), AddMicrotecAuthorization()
Current userICurrentUserService, CurrentUserService
MiddlewareTenantMiddleware, ErrorHandlingMiddleware, CorrelationIdMiddleware
LocalizationAddMicrotecLocalization(), ILocalizationService
BehaviorsValidationBehavior<TRequest,TResponse>, LoggingBehavior, PerformanceBehavior
SwaggerAddMicrotecSwagger() helper
FiltersApiKeyAuthFilter (for X-Api-Key internal routes)

Full service registration:

csharp
// Program.cs
builder.Services
    .AddMicrotecAuthentication(config)
    .AddMicrotecAuthorization()
    .AddMicrotecLocalization()
    .AddMicrotecSwagger()
    .AddMediatR(cfg =>
    {
        cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly());
        cfg.AddMicrotecBehaviors(); // Adds Validation, Logging, Performance behaviors
    });

Microtec.Web.Hosting

Purpose: Startup infrastructure — OpenTelemetry, Serilog, health checks.

CategoryWhat's Included
TelemetryAddMicrotecOpenTelemetry() — traces to OTLP, metrics
LoggingAddMicrotecSerilog() — structured logs to Seq
HealthAddMicrotecHealthChecks() — SQL, Redis, Service Bus checks
StartupAddMicrotecHosting() — all-in-one configuration
csharp
// Program.cs — all-in-one hosting setup
builder.AddMicrotecHosting(options =>
{
    options.ServiceName = "hr-api";
    options.EnableSwagger = builder.Environment.IsDevelopment();
});

Group 4: Feature Modules (Tier 4)

Microtec.Import.Domain

Purpose: Domain models for the Import feature.

What's Included
IImportable interface — entities that support bulk import
ImportJob, ImportRow, ImportValidationResult
ImportStatus enum

Microtec.Import.Infrastructure

Purpose: Excel/CSV import engine with validation pipeline.

What's Included
IImportService, ImportService
ExcelImportEngine, CsvImportEngine
ImportValidationPipeline, IImportValidator<T>
Column mapping via ImportColumnAttribute

Microtec.Import.Integration

Purpose: Integration contracts for the import feature.

What's Included
ImportCompletedEvent, ImportFailedEvent
IImportPublicApi — HTTP client for Import service

Microtec.Zatca.Infrastructure

Purpose: Saudi E-Invoicing (ZATCA Phase 2) implementation.

What's Included
IZatcaService, ZatcaService
XML invoice builder (UBL 2.1)
QR code generation (TLV encoding)
Digital signing (X.509 + CSR)
Compliance API client (ZatcaComplianceClient)
Clearance API client (ZatcaClearanceClient)

Microtec.Zatca.Integration

Purpose: ZATCA integration events and public API contracts.

What's Included
InvoiceSubmittedToZatcaEvent, ZatcaClearedEvent, ZatcaRejectedEvent
IZatcaPublicApi — typed HTTP client

Service Registration Summary

Most microservices use this standard bootstrap:

csharp
builder.AddMicrotecHosting(o => o.ServiceName = "service-name");  // Web.Hosting
builder.Services
    .AddMicrotecAuthentication(config)                             // Web.Core
    .AddMicrotecPersistence<MyDbContext>(config)                   // Persistence
    .AddMicrotecMessaging(config, consumers => { ... })            // Messaging
    .AddMicrotecPublicApis(config)                                 // PublicApi
    .AddAttachmentClient(config)                                   // Attachment.Client
    .AddNotificationClient(config);                                // Notifications.Client

Internal Documentation — Microtec Platform Team