Appearance
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.
| Category | What's Included |
|---|---|
| Base entities | BaseEntity, AggregateRoot, AuditableEntity, TenantEntity |
| Interfaces | ITenantProvider, IClockService, ICurrentUserService, IScopedService, ITransientService, ISingletonService |
| Value objects | Money, Address, PhoneNumber, EmailAddress |
| Result pattern | Result<T>, Result, Error, ErrorType |
| Exceptions | DomainException, NotFoundException, ValidationException, ForbiddenException |
| Enums | EntityStatus, AuditAction |
| Extensions | StringExtensions, 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.
| Category | What's Included |
|---|---|
| CQRS | ICommand, ICommand<T>, IQuery<T>, ICommandHandler<T>, IQueryHandler<T,R> |
| Response | APIResponse<T>, PagedResult<T>, PaginationMeta, ValidationError |
| Integration events | IIntegrationEvent, IntegrationEventBase |
| DTOs | PagedRequest, DropdownDto, AuditDto, IdNameDto |
| Events (25+) | See integration events section below |
Key integration events:
| Event | Publisher | Consumer |
|---|---|---|
TenantCreatedEvent | BusinessOwners | All services (seeding) |
TenantDeletedEvent | BusinessOwners | All services (cleanup) |
EmployeeCreatedEvent | HR | Notification, Workflow |
InvoiceApprovedEvent | Accounting | Integration, Notification |
WorkflowCompletedEvent | Workflow | All services |
UserProvisionedEvent | BusinessOwners | Keycloak, HR |
AttachmentUploadedEvent | Attachment | All services |
ImportCompletedEvent | Import | Originating service |
Group 2: Shared Infrastructure (Tier 2)
Microtec.Persistence
Purpose: EF Core infrastructure — repositories, unit of work, interceptors, multi-tenancy.
| Category | What's Included |
|---|---|
| Repository | RepositoryBase<T>, IRepository<T>, IReadRepository<T> |
| Unit of Work | IUnitOfWork<TContext>, UnitOfWorkBase<TContext>, IAdminUnitOfWork |
| Interceptors | AuditInterceptor, SoftDeleteInterceptor |
| EF Extensions | ConfigureAuditFields(), ConfigureSoftDelete(), ConfigureMultiTenancy(), ConfigureDecimalPrecision(), ApplyGlobalQueryFilters() |
| Specifications | ISpecification<T>, SpecificationEvaluator, BaseSpecification<T> |
| Multi-tenancy | TenantDbContextFactory, ITenantConnectionStringResolver |
See ef-core-patterns.md for full usage.
Microtec.Messaging
Purpose: MassTransit abstraction for Azure Service Bus and Redis.
| Category | What's Included |
|---|---|
| Publishers | IEventPublisher, ICommandPublisher, EventPublisher |
| Consumers | IIntegrationEventHandler<T>, ConsumerBase<T> |
| Redis | IDistributedCacheService, ICacheKeyBuilder, RedisDistributedCache |
| Outbox | IOutboxService, OutboxMessage, OutboxProcessor |
| Configuration | AddMicrotecMessaging(), 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.
| Category | What's Included |
|---|---|
| Admin client | IKeycloakAdminClient, KeycloakAdminClient |
| Provisioning | IKeycloakProvisioningService, RealmProvisioner, UserProvisioner |
| Token | ITokenIntrospectionService, KeycloakTokenValidator |
| Models | RealmRepresentation, UserRepresentation, ClientRepresentation |
| Flow | FlowPriority constants (MAC=10, Cookie=20, IdP=30) |
Microtec.PublicApi
Purpose: Typed HTTP clients for inter-service communication.
| Client Interface | Downstream Service |
|---|---|
IAccountingPublicApi | AppsPortal.Apis (Accounting) |
IHrPublicApi | HR.Apis |
IInventoryPublicApi | Inventory.Apis |
IWorkflowPublicApi | Workflows.Apis |
IAttachmentPublicApi | Attachment.Apis |
INotificationPublicApi | Notification.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.
| Category | What's Included |
|---|---|
| Engine | IReportingService, ReportingService |
| Templates | IReportTemplate, ReportTemplateBase |
| Renderers | PdfRenderer, ExcelRenderer |
| Models | ReportRequest, 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.
| Category | What's Included |
|---|---|
| Auth | AddMicrotecAuthentication(), AddMicrotecAuthorization() |
| Current user | ICurrentUserService, CurrentUserService |
| Middleware | TenantMiddleware, ErrorHandlingMiddleware, CorrelationIdMiddleware |
| Localization | AddMicrotecLocalization(), ILocalizationService |
| Behaviors | ValidationBehavior<TRequest,TResponse>, LoggingBehavior, PerformanceBehavior |
| Swagger | AddMicrotecSwagger() helper |
| Filters | ApiKeyAuthFilter (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.
| Category | What's Included |
|---|---|
| Telemetry | AddMicrotecOpenTelemetry() — traces to OTLP, metrics |
| Logging | AddMicrotecSerilog() — structured logs to Seq |
| Health | AddMicrotecHealthChecks() — SQL, Redis, Service Bus checks |
| Startup | AddMicrotecHosting() — 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