This an implementation based on the tutorial linked below but with netcoreapp3.1
instead of netframework4.6
.
For educational purposes only.
dotnet new sln --name Demo.DependencyInjection
Reference: dotnet new - .NET Core CLI | Microsoft Docs ◳
dotnet new console --name Demo.DependencyInjection.Application
dotnet new classlib --name Demo.DependencyInjection.Implementation1 --framework netcoreapp3.1
dotnet sln Demo.DependencyInjection.sln add Demo.DependencyInjection.Application/Demo.DependencyInjection.Application.csproj Demo.DependencyInjection.Implementation1/Demo.DependencyInjection.Implementation1.csproj
Reference: dotnet sln - .NET Core CLI | Microsoft Docs ◳
Typing...
dotnet add Demo.DependencyInjection.Application/Demo.DependencyInjection.Application.csproj reference Demo.DependencyInjection.Implementation1/Demo.DependencyInjection.Implementation1.csproj
Reference: dotnet add reference - .NET Core CLI | Microsoft Docs ◳
Typing...
dotnet run --project Demo.DependencyInjection.Application\Demo.DependencyInjection.Application.csproj
Reference: dotnet run - .NET Core CLI | Microsoft Docs ◳
dotnet new classlib --name Demo.DependencyInjection.Abstractions --framework netcoreapp3.1
dotnet sln Demo.DependencyInjection.sln add Demo.DependencyInjection.Abstractions/Demo.DependencyInjection.Abstractions.csproj
Typing...
dotnet add Demo.DependencyInjection.Implementation1/Demo.DependencyInjection.Implementation1.csproj reference Demo.DependencyInjection.Abstractions/Demo.DependencyInjection.Abstractions.csproj
Modify class file CoinExchanger in classlib Demo.DependencyInjection.Implementation1 and rename to CoinExchanger1
Typing...
dotnet new classlib --name Demo.DependencyInjection.Implementation2 --framework netcoreapp3.1
dotnet sln Demo.DependencyInjection.sln add Demo.DependencyInjection.Implementation2/Demo.DependencyInjection.Implementation2.csproj
dotnet add Demo.DependencyInjection.Implementation2/Demo.DependencyInjection.Implementation2.csproj reference Demo.DependencyInjection.Abstractions/Demo.DependencyInjection.Abstractions.csproj
Typing...
dotnet add Demo.DependencyInjection.Application/Demo.DependencyInjection.Application.csproj reference Demo.DependencyInjection.Implementation2/Demo.DependencyInjection.Implementation2.csproj
Typing...
dotnet run --project Demo.DependencyInjection.Application\Demo.DependencyInjection.Application.csproj
dotnet add Demo.DependencyInjection.Application\Demo.DependencyInjection.Application.csproj package Autofac --version 5.2.0
Reference: dotnet add package - .NET Core CLI | Microsoft Docs ◳
Reference: Autofac 5.2.0 | Nuget Gallery ◳
Typing...
Link: AutoFac Docs ◳
dotnet run --project Demo.DependencyInjection.Application\Demo.DependencyInjection.Application.csproj
Referenced tutorial: ¿Qué es la inyección de dependencias, para qué sirve y qué significan los tiempos de vida en su implementación? | Baufest© 2020 ◳