Book Image

Mastering ServiceStack

By : Andreas Niedermair
Book Image

Mastering ServiceStack

By: Andreas Niedermair

Overview of this book

Table of Contents (13 chapters)

The IoC container


Many books and articles have been written on Inversion of Control (IoC) and dependency injection, this minimizes the need for an introduction to these paradigms. In short, it's one of the SOLID principals that talk about how to loosely couple concrete implementations with clients, for example to exchange implementations without needing to modify the clients.

Funq was made the default ServiceStack implementation due to its excellent performance and memory characteristics, as well as the basic and clean API. It's enhanced with expression-based auto-wiring and lifetime scopes. Nevertheless, ServiceStack supports the usage of other IoC containers, which we will cover later in this chapter.

The central access point for dependency registrations is the Container property of your host, which you should only access from within the Configure method to register mappings, as this is guaranteed to make your registration calls thread safe.

Registering dependencies

There are two ways to register...