Crispy Waffle

A toolkit for .NET applications: service location, logging, caching, events, commands, cron scheduling, serialization, template rendering and more, with integration packages for Redis, RabbitMQ, ElasticSearch, CouchDB, Log4Net, ELMAH and the Windows Event Log.

Crispy Waffle Logo

This project is proudly maintained by @guibranco GitHub followers.

Source code available at: GitHub GitHub stars.

Currently opened issues: GitHub issues.

Project status

Build and tests Release Last commit Coverage Code Smells Lines of Code
Build, Test and Analyze Release GitHub last commit Coverage Code Smells Lines of Code

Quick look

using CrispyWaffle.Cache;
using CrispyWaffle.Composition;
using CrispyWaffle.Log;
using CrispyWaffle.Log.Adapters;
using CrispyWaffle.Log.Providers;

ServiceLocator.Register<IConsoleLogAdapter, StandardConsoleLogAdapter>(Lifetime.Singleton);
LogConsumer.AddProvider<ConsoleLogProvider>();
CacheManager.AddRepository<MemoryCacheRepository>();

LogConsumer.Info("Hello from Crispy Waffle");

await CacheManager.SetAsync(42, "answer");
var answer = await CacheManager.GetAsync<int>("answer");

New here? Start with Getting started.

Architecture

The core CrispyWaffle package exposes static facades with pluggable extension points. Integration packages implement those extension points, and two standalone packages build on Microsoft.Extensions.*.

CrispyWaffle package architecture

More diagrams (logging, caching, events and commands, background jobs) are on the Diagrams page.

Core modules

Everything below ships in the CrispyWaffle package.

Module What it does
Service Locator Lightweight IoC container: register contracts, resolve instances, bootstrappers
Logging LogConsumer facade with filters, multiple providers and exception handlers
Caching CacheManager facade over prioritized cache repositories
Events One-to-many event dispatch to IEventHandler<TEvent> implementations
Commands One-to-one command dispatch returning a result
Scheduler Cron-based job scheduling with JobManager
Serialization JSON, XML, YAML and TOML serializer adapters, SerializerFactory
Telemetry TelemetryAnalytics facade for counters, events and exceptions
Template rendering Mustache-style text template engine
Cryptography AES string encryption and MD5/SHA hashing (legacy compatibility)
Extension methods Conversion, string, enum, exception, math, type and XML helpers
Utilities Query string builder, resettable lazy values, dynamic serialization, phone numbers
Validations CPF, CNPJ and e-mail validation, shared regular expressions
Attributes Metadata attributes used across the library
Good practices Small building blocks for safer code
Infrastructure Environment information and library constants

Integration packages

Package What it adds
CrispyWaffle.Configuration Connection and credential abstractions shared by the integration packages
CrispyWaffle.Redis Redis cache repository, Pub/Sub log provider and telemetry client
CrispyWaffle.RabbitMQ RabbitMQ messaging wrapper and log provider
CrispyWaffle.ElasticSearch ElasticSearch client wrapper and log provider
CrispyWaffle.CouchDB CouchDB cache repository (not yet on NuGet)
CrispyWaffle.Log4Net Log provider that forwards to log4net
CrispyWaffle.EventLog Windows Event Log provider
CrispyWaffle.Elmah Exception handler that forwards to ELMAH
CrispyWaffle.Utils FTP client and SMTP mailer
CrispyWaffle.I18n.PtBr Brazilian Portuguese conversions
CrispyWaffle.HttpClient Standalone typed HTTP client wrapper with retries (not yet on NuGet)
CrispyWaffle.BackgroundJobs Standalone hosted background job processing (not yet on NuGet)

Examples

Most features are covered by tests, and the test projects are a good source of working examples.