Skip to content
 
 

Repository files navigation

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.

Area Package Version Downloads Coverage
Archiver Curiosus.Archiver NuGet Downloads Coverage
Curiosus.Archiver.SharpZip NuGet Downloads Coverage
Configuration Curiosus.Configuration NuGet Downloads Coverage
Curiosus.Configuration.YML NuGet Downloads Coverage
Data access Curiosus.DAL NuGet Downloads Coverage
Curiosus.DAL.Dapper NuGet Downloads Coverage
Curiosus.DAL.EF NuGet Downloads Coverage
Curiosus.DAL.NpgSQL NuGet Downloads Coverage
Curiosus.DAL.EF.Polly NuGet Downloads Coverage
Email Curiosus.EMail NuGet Downloads Coverage
Curiosus.EMail.Mailgun NuGet Downloads Coverage
Curiosus.EMail.SMTP NuGet Downloads Coverage
Curiosus.EMail.UnisenderGo NuGet Downloads Coverage
File data Curiosus.FileDataReaderWriters NuGet Downloads Coverage
Curiosus.FileDataReaderWriters.Npoi NuGet Downloads Coverage
Curiosus.FileDataReaderWriters.SylvanCsv NuGet Downloads Coverage
Hosting Curiosus.Hosting NuGet Downloads Coverage
Curiosus.Hosting.Web NuGet Downloads Coverage
Localization Curiosus.Localization NuGet Downloads Coverage
Curiosus.Localization.MVC NuGet Downloads Coverage
Messaging Curiosus.RabbitMQ NuGet Downloads Coverage
Notifications Curiosus.Notifications NuGet Downloads Coverage
Curiosus.Notifications.EMail NuGet Downloads Coverage
Curiosus.Notifications.SMS NuGet Downloads Coverage
Request processing Curiosus.RequestProcessing NuGet Downloads Coverage
Curiosus.RequestProcessing.Postgres NuGet Downloads Coverage
Curiosus.RequestProcessing.RabbitMQ NuGet Downloads Coverage
SFTP Curiosus.SFTP NuGet Downloads Coverage
Curiosus.SFTP.SSH.NET NuGet Downloads Coverage
SMS Curiosus.SMS NuGet Downloads Coverage
Curiosus.SMS.Iqsms NuGet Downloads Coverage
Curiosus.SMS.Smsc NuGet Downloads Coverage
Miscellaneous Curiosus.DataAnnotations NuGet Downloads Coverage
Curiosus.Tools NuGet Downloads Coverage
Curiosus.Cache.MemoryCache NuGet Downloads Coverage
Curiosus.DateTime.DbSync NuGet Downloads Coverage
Curiosus.Tools.Web NuGet Downloads Coverage

License

Licensed under the MIT License.

About

Building blocks for .NET services: configuration, hosting, data access, email and SMS, notifications, request processing

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages