This commit is contained in:
Holger Boerchers 2018-12-14 22:48:42 +01:00
parent 5ad02969e9
commit a625f19d0d
6 changed files with 83 additions and 8 deletions

47
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,47 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/InjectorTest/bin/Debug/netcoreapp2.1/InjectorTest.dll",
"args": [],
"cwd": "${workspaceFolder}/InjectorTest",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
,
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/InjectorTest/bin/Debug/netcoreapp2.1/InjectorTest.dll",
"args": [],
"cwd": "${workspaceFolder}/InjectorTest",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}

25
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,25 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/InjectorTest/InjectorTest.csproj"
],
"problemMatcher": "$msCompile"
},
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/InjectorTest/InjectorTest.csproj"
],
"problemMatcher": "$msCompile"
}
]
}

View File

@ -1,15 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<LangVersion>7.1</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.0" /> <PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0"> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference> </PackageReference>

View File

@ -29,7 +29,7 @@ namespace SmallInjectorDemo
useful2.TestTheServices(); useful2.TestTheServices();
Console.WriteLine(); Console.WriteLine();
useful3.TestTheServices(); useful3.TestTheServices();
Console.ReadLine(); //Console.ReadLine();
} }
} }
} }

View File

@ -17,7 +17,7 @@ namespace SmallInjectorDemo
/// <typeparam name="TInterface">Type of the interface of the service.</typeparam> /// <typeparam name="TInterface">Type of the interface of the service.</typeparam>
/// <param name="isSingleton">True if the service should be singleton. False otherwise.</param> /// <param name="isSingleton">True if the service should be singleton. False otherwise.</param>
/// <param name="instance">instance of the service</param> /// <param name="instance">instance of the service</param>
public void RegisterType<TService, TInterface>(bool isSingleton, TService instance = default(TService)) where TService : TInterface public void RegisterType<TService, TInterface>(bool isSingleton, TService instance = default) where TService : TInterface
{ {
_container.Add(typeof(TInterface), new RegisteredType(typeof(TService), isSingleton, null)); _container.Add(typeof(TInterface), new RegisteredType(typeof(TService), isSingleton, null));
} }
@ -26,7 +26,7 @@ namespace SmallInjectorDemo
/// Register types in the resolve container. /// Register types in the resolve container.
/// </summary> /// </summary>
/// <typeparam name="TService">Type of the service.</typeparam> /// <typeparam name="TService">Type of the service.</typeparam>
public void RegisterType<TService>(bool isSingleton, TService instance = default(TService)) => RegisterType<TService, TService>(isSingleton, instance); public void RegisterType<TService>(bool isSingleton, TService instance = default) => RegisterType<TService, TService>(isSingleton, instance);
/// <summary> /// <summary>
/// Resolve service of specified type. /// Resolve service of specified type.

View File

@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<AssemblyName>SmallInjectorDemo</AssemblyName> <AssemblyName>SmallInjectorDemo</AssemblyName>
<RootNamespace>SmallInjectorDemo</RootNamespace> <RootNamespace>SmallInjectorDemo</RootNamespace>
<LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\netcoreapp2.1\SmallInjectorDemo.xml</DocumentationFile> <DocumentationFile>bin\Debug\netcoreapp2.1\SmallInjectorDemo.xml</DocumentationFile>