Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

Infrastructure

[email protected] edited this page Nov 29, 2019 · 1 revision

Chromely adapts very lightweight reliable open source frameworks to do logging, dependency injection (IoC) and Json serialization. Both logging and IoC features are configurable and replaceable. The Json serializer too can be extended/replaced with new serializer(s) when custom handlers are implemented.

Logger

Chromely provides a simple default logger. The logging utility is at SimpleLogger. If the developer is satisfied with SimpleLogger nothing needs to be done.

The default logger can also be configured - filename can be changed and a flag can be set if logs can be written to the console.

ChromelyConfiguration config = ChromelyConfiguration
                              .Create()
                              .....
                              .UseDefaultLogger("logs\\chromely_new.log", true)
                              ....

A new logger (of type IChromelyLogger) can be set.

IChromelyLogger logger = new NewLogger();
ChromelyConfiguration config = ChromelyConfiguration
                              .Create()
                               ....
                              .WithLogger(logger)
                              ....

IoC Container

Chromely adapts Caliburn.Micro SimpleContainer. This is provided almost as-is. This is easily replaceable by a new container.

If the developer is satisfied with Calibrun.Micro SimpleContainer nothing needs to be done.

A new IOC container (of type IChromelyContainer) can be set prior to setting the configuration object or set passing via constructor (create). *** This must be done prior to other registrations otherwise the default container will kick in during these registrations and will be lost (invalid). ONLY one IOC container is required.

// The IOC container must implement the IChromelyContainer interface.
IChromelyContainer newContainer = new CustomContainer();
IoC.Container = newContainer;

Or:

// The IOC container must implement the IChromelyContainer interface.
IChromelyContainer newContainer = new CustomContainer();
ChromelyConfiguration config = ChromelyConfiguration()
                              .Create(newContainer)
                              .....

Json Serializer

Chromely adapts LitJson for Json serialization. This is provided almost as-is.

Clone this wiki locally