Initial commit

pull/3294/head
mouaaz 2 years ago
parent fb098550b4
commit 5d66bf786e
  1. 11
      src/roadmaps/aspnet-core/content/105-dependency-injection/100-scrutor.md
  2. 12
      src/roadmaps/aspnet-core/content/105-dependency-injection/101-di-containers/100-microsoft-extensions-dependency-injection.md
  3. 12
      src/roadmaps/aspnet-core/content/105-dependency-injection/101-di-containers/101-auto-fac.md
  4. 12
      src/roadmaps/aspnet-core/content/105-dependency-injection/101-di-containers/102-ninject.md
  5. 12
      src/roadmaps/aspnet-core/content/105-dependency-injection/101-di-containers/103-castle-windsor.md
  6. 12
      src/roadmaps/aspnet-core/content/105-dependency-injection/101-di-containers/104-simple-injector.md
  7. 12
      src/roadmaps/aspnet-core/content/105-dependency-injection/101-di-containers/index.md
  8. 11
      src/roadmaps/aspnet-core/content/105-dependency-injection/102-life-cycles/100-scoped.md
  9. 12
      src/roadmaps/aspnet-core/content/105-dependency-injection/102-life-cycles/101-transient.md
  10. 12
      src/roadmaps/aspnet-core/content/105-dependency-injection/102-life-cycles/102-singleton.md
  11. 10
      src/roadmaps/aspnet-core/content/105-dependency-injection/102-life-cycles/index.md
  12. 15
      src/roadmaps/aspnet-core/content/105-dependency-injection/index.md

@ -1 +1,10 @@
# Scrutor
# Scrutor
Scrutor is an open-source library for .NET that extends the functionality of the built-in dependency injection framework in .NET Core. It provides a set of extension methods for the `IServiceCollection` interface, which can be used to register and configure services in a more convenient and flexible way.
One of the main features of Scrutor is its ability to automatically scan assemblies for services and register them with the dependency injection container, allowing you to avoid having to manually register each service one by one. It also provides a fluent API that makes it easy to configure services, such as specifying the lifetime of a service, adding decorators, and more.
For more information, visit the following resources:
- [How to use Scrutor in ASP.Net Core?](https://www.infoworld.com/article/3321356/how-to-use-scrutor-in-aspnet-core.html)
- [Complete Guide to Scrutor](https://andrewlock.net/using-scrutor-to-automatically-register-your-services-with-the-asp-net-core-di-container/)

@ -1 +1,11 @@
# Microsoft extensions dependency injection
# Microsoft Extensions Dependency Injection
Microsoft.Extensions.DependencyInjection is a dependency injection framework that is part of the Microsoft.Extensions.DependencyInjection NuGet package. It is used to create and manage instances of objects and their dependencies, and is particularly useful for implementing the Dependency Inversion Principle in .NET applications.
The package provides a simple and consistent API for registering services and resolving dependencies, which can be used to configure and manage the lifetime of objects in an application. It also provides built-in support for various types of service lifetime, such as transient, singleton and scoped.
For more information, visit the following links:
- [Guide to Microsoft Extensions Dependency Injection](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection?view=dotnet-plat-ext-7.0)
- [Exploring the Microsoft.Extensions.DependencyInjection](https://www.codeproject.com/Articles/5339241/Exploring-the-Microsoft-Extensions-DependencyInjec)
- [How to use Microsoft.Extensions.DependencyInjection](https://stackoverflow.com/questions/53825155/how-can-i-use-microsoft-extensions-dependencyinjection-in-an-net-core-console-a)

@ -1 +1,11 @@
# Auto fac
# Autofac
Autofac is an open-source dependency injection framework for .NET. It is designed to make it easier to manage the dependencies of an application by automatically resolving and managing the lifetime of objects and their dependencies.
Autofac uses a technique called "component registration" to define the objects and dependencies of an application. This is done by creating instances of the `ContainerBuilder` class and using its methods to register types, instances and factories. Then, the `Build()` method is called to create an instance of the `IContainer` interface, which can be used to resolve dependencies throughout the application.
Visit the following resources for more information:
- [Autofac’s Documentation](https://autofac.readthedocs.io/en/latest/)
- [Getting started with Autofac](https://autofac.org/)
- [Dependency Injection with Autofac](https://www.codeproject.com/Articles/25380/Dependency-Injection-with-Autofac)

@ -1 +1,11 @@
# Ninject
# Ninject
Ninject is an open-source dependency injection framework for .NET. It is designed to make it easier to manage the dependencies of an application by automatically resolving and managing the lifetime of objects and their dependencies.
Ninject uses a technique called "binding" to define the objects and dependencies of an application. This is done by creating instances of the `StandardKernel` class and using its methods to register types, instances and factories. Then, the `Get()` method is called to resolve the dependencies throughout the application.
For more information, visit the following resources:
- [Intro to Ninject](http://www.ninject.org/)
- [What is Ninject and when do you use it?](https://stackoverflow.com/questions/17375234/what-is-ninject-and-when-do-you-use-it)
- [How to use NInject?](https://www.infoworld.com/article/3191648/how-to-implement-di-in-webapi-using-ninject.html)

@ -1 +1,11 @@
# Castle windsor
# Castle Windsor
Castle Windsor is an open-source dependency injection framework for .NET. It is designed to make it easier to manage the dependencies of an application by automatically resolving and managing the lifetime of objects and their dependencies.
Castle Windsor uses a technique called "registration" to define the objects and dependencies of an application. This is done by creating instances of the `WindsorContainer` class and using its methods to register types, instances and factories. Then, the `Resolve()` method is called to resolve the dependencies throughout the application.
Visit the following links for more resources:
- [Getting Started with Dependency Injection Using Castle Windsor](https://www.codementor.io/@copperstarconsulting/getting-started-with-dependency-injection-using-castle-windsor-4meqzcsvh)
- [What is Castle Windsor?](https://stackoverflow.com/questions/124871/what-is-castle-windsor-and-why-should-i-care)
- [Intro to Castle Windsor](http://www.castleproject.org/projects/windsor/)

@ -1 +1,11 @@
# Simple injector
# Simple Injector
Simple Injector is an open-source dependency injection framework for .NET. It is designed to make it easy to manage the dependencies of an application by automatically resolving and managing the lifetime of objects and their dependencies.
Simple Injector uses a technique called "registration" to define the objects and dependencies of an application. This is done by creating an instance of the `Container` class and using its methods to register types, instances and factories. Then, the `GetInstance()` method is called to resolve the dependencies throughout the application.
For more information, visit the following resources:
- [How to use Simple Injector?](https://www.infoworld.com/article/3636242/how-to-use-simple-injector-in-aspnet-core-mvc.html)
- [Simple Injector's Documentation](https://docs.simpleinjector.org/en/latest/)
- [Example of Dependency Injection Using Simple Injector](https://www.c-sharpcorner.com/UploadFile/4d9083/dependency-injection-using-simple-injector/)

@ -1 +1,11 @@
# Di containers
# DI Containers
A dependency injection (DI) container is a software component that is responsible for managing the dependencies of an application. It is used to create and manage instances of objects and their dependencies, and is particularly useful for implementing the Dependency Inversion Principle in software development.
A DI container typically consists of two main parts: a configuration API, which is used to register the types and their dependencies, and a resolution API, which is used to retrieve instances of the registered types. The DI container automatically resolves the dependencies of the objects it creates, and manages the lifetime of the objects and their dependencies.
For more information, visit the following links:
- [What is DI Container?](https://www.dotnettricks.com/learn/dependencyinjection/what-is-ioc-container-or-di-container)
- [Getting Started with DI Container](https://stackoverflow.com/questions/50718586/what-is-a-di-container)
- [How to Use DI Container?](https://learn.userfrosting.com/services/the-di-container)

@ -1 +1,10 @@
# Scoped
# Scoped
Scoped lifetime is a type of dependency injection that creates a new instance of an object for each unique request, but reuses the same instance for the same request. This means that if multiple components within the same request depend on the same service, they will all receive the same instance. However, if another request is made, a new instance of the service will be created for that request.
Scoped lifetime is useful when you have services that are specific to a given request, such as a request-scoped database context. This allows you to have a separate and isolated instance of a service for each unique request, which can help to prevent cross-request contamination of data and improve performance.
For more information, visit the following resources:
- [Dependency Injection - What is Scope?](https://javaranch.com/journal/2008/10/dependency-injection-what-is-scope.html)
- [Effective Dependency Injection Scoping](https://medium.com/android-news/effective-dependency-injection-scoping-4bac813d4491)

@ -1 +1,11 @@
# Transient
# Transient
Transient lifetime is a type of dependency injection that creates a new instance of an object each time it is requested. This means that if multiple components within the same request or across different requests depend on the same service, they will each receive a new instance of the service.
Transient lifetime is useful when you have services that are stateless and do not need to maintain any data between requests, such as a service that performs a simple calculation or returns data from a database.
For more information:
- [What are Transient Dependencies?](https://blazor-university.com/dependency-injection/dependency-lifetimes-and-scopes/transient-dependencies/)
- [Dependency Injection Lifetime](https://www.tektutorialshub.com/asp-net-core/asp-net-core-dependency-injection-lifetime/)
- [Dependency Injection Explained with Transient](https://www.youtube.com/watch?v=NkTF_6IQPiY)

@ -1 +1,11 @@
# Singleton
# Singleton
Singleton lifetime is a type of dependency injection that creates a single instance of an object and reuses it throughout the lifetime of the application. This means that if multiple components within the same request or across different requests depend on the same service, they will all receive the same instance of the service.
Singleton lifetime is useful when you have services that need to maintain state or shared data across requests, such as a service that caches data or maintains a connection to a resource.
For more information:
- [What are Singleton Dependencies?](https://blazor-university.com/dependency-injection/dependency-lifetimes-and-scopes/transient-dependencies/)
- [Dependency Injection Lifetime](https://www.tektutorialshub.com/asp-net-core/asp-net-core-dependency-injection-lifetime/)
- [Dependency Injection Explained with Singleton](https://www.youtube.com/watch?v=NkTF_6IQPiY)

@ -1 +1,9 @@
# Life cycles
# Life Cycles
For more resources, visit the following links:
- [Complete Guide to Dependency Injection Lifecycles](https://www.youtube.com/watch?v=wA5bPsv2CLA)
- [What are Service Life Cyles in ASP.NET Core?](https://endjin.com/blog/2022/09/service-lifetimes-in-aspnet-core)
- [Learn Service Lifetimes in .NET Core](https://henriquesd.medium.com/dependency-injection-and-service-lifetimes-in-net-core-ab9189349420)

@ -1 +1,14 @@
# Dependency injection
# Dependency Injection
Dependency injection (DI) is a software design pattern that is used to manage the dependencies of an application. It is a technique that allows developers to write loosely-coupled code, by separating the responsibility of creating and managing objects from the objects themselves.
In a typical implementation, a DI container is used to manage the dependencies of the application. The container is responsible for creating and managing instances of objects and their dependencies, and providing them to other objects as needed.
There are different types of dependency injection, such as Constructor injection, Property injection, and Method injection, which can be used depending on the requirement and the design of the application.
Visit the following links for more resources:
- [What is Dependency Injection?](https://stackoverflow.com/questions/130794/what-is-dependency-injection)
- [Dependency Injection, It's Definition & principles](https://www.growin.com/blog/what-is-dependency-injection/)
- [Intro to Dependency Injections](https://www.freecodecamp.org/news/a-quick-intro-to-dependency-injection-what-it-is-and-when-to-use-it-7578c84fa88f/)
Loading…
Cancel
Save