Last active
April 15, 2019 12:06
-
-
Save fredrikhr/7104b41202ee885c7de8d72b67d77407 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp2.1</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.3.100.5" /> | |
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" /> | |
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" /> | |
</ItemGroup> | |
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace DICliTest | |
{ | |
public static class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var config = new ConfigurationBuilder() | |
.AddJsonFile("appsettings.json", optional: true) | |
.Build(); | |
var services = new ServiceCollection() | |
.AddSingleton<IConfiguration>(config) | |
.AddTransient<Startup>() | |
; | |
var diContainer = services.BuildServiceProvider(); | |
var app = diContainer.GetService<Startup>(); | |
app.Run(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.Configuration; | |
namespace DICliTest | |
{ | |
public class Startup | |
{ | |
public IConfiguration Configuration { get; } | |
public Startup(IConfiguration configuration) | |
{ | |
Configuration = configuration; | |
} | |
public void Run() | |
{ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment