From IT Skills
Jump to: navigation, search

Inversion of control[edit]

Inversion of control carries the strong connotation that the reusable code and the problem-specific code are developed independently even though they operate together in an application. Callbacks, schedulers, event loops, dependency injection, and the template method are examples of design patterns that follow the inversion of control... purposes: To decouple the execution of a task from implementation. To focus a module on the task it is designed for. To free modules from assumptions about how other systems do

DI[edit]

Для передачи зависимости в метод применяется атрибут [FromServices.. предоставляется инфраструктурой MVC

мы можем использовать зависимости в представлении... Директива @inject принимает два параметра: первый параметр представляет тип, а второй - название переменной

tools[edit]

Simple Injector is an easy-to-use Dependency Injection (DI) library for .NET that supports .NET Core, Xamarin, Mono and Universal apps. Simple Injector is easily integrated with frameworks such as Web API, MVC, WCF, ASP.NET Core

Autofac[edit]

Autofac is an addictive Inversion of Control container for .NET.

During application execution, you’ll need to make use of the components you registered. You do this by resolving them from a lifetime scope... create a child lifetime scope from the container and resolve from that. When you’re done resolving components, dispose of the child scope

when you register OWIN middleware