Skip to content

Latest commit

 

History

History
30 lines (16 loc) · 835 Bytes

File metadata and controls

30 lines (16 loc) · 835 Bytes

Examples

example-01.py

This example illustrates a basic usage of the Container class to register two types, and automatic resolution achieved through types inspection.

Two services are registered as "transient" services, meaning that a new instance is created whenever needed.

example-02.py

This example illustrates a basic usage of the Container class to register a concrete type by base type, and its activation by base type.

This pattern helps writing code that is decoupled (e.g. business layer logic separated from exact implementations of data access logic).

example-03.py

This example illustrates how to configure a singleton object.

example-04.py

This example illustrates how to use the decorator pattern (available since 2.1.0).