Skip to main content

Curiosus.Utils

A collection of .NET building blocks for backend services: application hosting, YAML configuration, data access, e-mail and SMS, notifications, request processing, file formats, localization and more.

Build License NuGet Downloads Coverage Docs

Renamed: formerly Curiosity.* by SIIS Ltd. Since 2.0.0 the packages are published as Curiosus.* by curiosus-dev. To migrate, replace Curiosity with Curiosus in package references and code.

Why use it​

  • Small, focused packages. Every area is an abstraction package plus implementations (Curiosus.EMail + SMTP/Mailgun/Unisender Go, Curiosus.SMS + smsc.ru/iqsms.ru, Curiosus.SFTP + SSH.NET), so an application depends on the contract and picks the provider in one registration.
  • Production defaults. Options are validated at startup, so a wrong configuration fails fast instead of at the first request; errors come back as typed codes rather than provider-specific exceptions.
  • Consistent across services. The same bootstrapping, configuration layout, logging and error model in console tools, background workers and web applications.
  • Plain DI. Everything is registered with Add... extensions on IServiceCollection, no framework to adopt.

Features​

  • Hosting — bootstrappers for console tools, background services and ASP.NET Core apps: CLI arguments, YAML config with validation, NLog, async app initializers, thread pool tuning, watchdog services.
  • Configuration — layered config*.yml files (secret, per-environment) with environment variable and CLI overrides, strongly typed options validation and startup printing.
  • Data access — abstractions over EF Core and Dapper with transaction-completed events, pagination, a Polly retry policy for concurrency errors and PostgreSQL helpers (binary COPY bulk insert).
  • E-mail and SMS — one IEMailSender / ISmsSender contract with SMTP (MailKit), Mailgun, Unisender Go, smsc.ru and iqsms.ru providers, unified error codes and per-message overrides.
  • Notifications — one INotificator call fans an event out to e-mail, SMS or custom channels running as queued background services, with post-processors for the results.
  • Request processing — a fixed pool of workers in a hosted service, fed from a Postgres table queue (LISTEN/NOTIFY) or RabbitMQ; plus a RabbitMQ request-reply client.
  • Files — streaming XLSX (NPOI) and CSV (Sylvan/CsvHelper) readers and writers, ZIP archives (SharpZipLib), SFTP (SSH.NET).
  • Web — ASP.NET Core middleware, model binders, data protection, reCAPTCHA, sitemap; localization keyed by source text with plural forms for code and Razor views.
  • Toolkit — distributed unique ids, the Response/Error result model, date/time helpers, memory cache helpers, data annotations, a database-synchronized clock, sensitive data masking, performance tracing.

Quick start​

Install the packages you need, for example a background service with YAML configuration:

dotnet add package Curiosus.Hosting
public class AppConfiguration : CuriosusAppConfiguration
{
public AppConfiguration()
{
AppName = "Sample Worker";
}
}

public class AppBootstrapper : CuriosusServiceAppBootstrapper<CuriosusCLIArguments, AppConfiguration>
{
public AppBootstrapper()
{
ConfigureServices((context, services, configuration) =>
{
services.AddHostedService<SampleWorker>();
});
}
}

// Program.cs
return await new AppBootstrapper().RunAsync(args);

Each package README shows its registration and configuration, see Available packages.

Packages are layered​

Packages depend only on what they need. Curiosus.Tools is the foundation with few dependencies; abstraction packages (Curiosus.DAL, Curiosus.EMail, Curiosus.SMS, Curiosus.SFTP, Curiosus.Notifications, Curiosus.RequestProcessing, Curiosus.FileDataReaderWriters, Curiosus.Archiver) define contracts, and implementation packages add one provider each. Libraries and domain code reference abstractions; the application references the implementations it registers.

Each package is versioned and released independently, see its CHANGELOG.md. Full documentation: curiosus-dev.github.io/Curiosus.Utils.

Available packages​

Coverage is line coverage by the repository tests, "no tests" means the package has none yet.

AreaPackageVersionDownloadsCoverage
ArchiverCuriosus.ArchiverNuGetDownloadsCoverage
Curiosus.Archiver.SharpZipNuGetDownloadsCoverage
ConfigurationCuriosus.ConfigurationNuGetDownloadsCoverage
Curiosus.Configuration.YMLNuGetDownloadsCoverage
Data accessCuriosus.DALNuGetDownloadsCoverage
Curiosus.DAL.DapperNuGetDownloadsCoverage
Curiosus.DAL.EFNuGetDownloadsCoverage
Curiosus.DAL.NpgSQLNuGetDownloadsCoverage
Curiosus.DAL.EF.PollyNuGetDownloadsCoverage
EmailCuriosus.EMailNuGetDownloadsCoverage
Curiosus.EMail.MailgunNuGetDownloadsCoverage
Curiosus.EMail.SMTPNuGetDownloadsCoverage
Curiosus.EMail.UnisenderGoNuGetDownloadsCoverage
File dataCuriosus.FileDataReaderWritersNuGetDownloadsCoverage
Curiosus.FileDataReaderWriters.NpoiNuGetDownloadsCoverage
Curiosus.FileDataReaderWriters.SylvanCsvNuGetDownloadsCoverage
HostingCuriosus.HostingNuGetDownloadsCoverage
Curiosus.Hosting.WebNuGetDownloadsCoverage
LocalizationCuriosus.LocalizationNuGetDownloadsCoverage
Curiosus.Localization.MVCNuGetDownloadsCoverage
MessagingCuriosus.RabbitMQNuGetDownloadsCoverage
NotificationsCuriosus.NotificationsNuGetDownloadsCoverage
Curiosus.Notifications.EMailNuGetDownloadsCoverage
Curiosus.Notifications.SMSNuGetDownloadsCoverage
Request processingCuriosus.RequestProcessingNuGetDownloadsCoverage
Curiosus.RequestProcessing.PostgresNuGetDownloadsCoverage
Curiosus.RequestProcessing.RabbitMQNuGetDownloadsCoverage
SFTPCuriosus.SFTPNuGetDownloadsCoverage
Curiosus.SFTP.SSH.NETNuGetDownloadsCoverage
SMSCuriosus.SMSNuGetDownloadsCoverage
Curiosus.SMS.IqsmsNuGetDownloadsCoverage
Curiosus.SMS.SmscNuGetDownloadsCoverage
MiscellaneousCuriosus.DataAnnotationsNuGetDownloadsCoverage
Curiosus.ToolsNuGetDownloadsCoverage
Curiosus.Cache.MemoryCacheNuGetDownloadsCoverage
Curiosus.DateTime.DbSyncNuGetDownloadsCoverage
Curiosus.Tools.WebNuGetDownloadsCoverage

License​

Licensed under the MIT License.