Skip to content

Commit d28f6fb

Browse files
authored
First commit
0 parents  commit d28f6fb

File tree

8 files changed

+141
-0
lines changed

8 files changed

+141
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Interfaces;
2+
using System;
3+
4+
namespace Implementations
5+
{
6+
public class ImplementationN : InterfaceN
7+
{
8+
public string GetString()
9+
{
10+
return "Hello world!";
11+
}
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
</PropertyGroup>
6+
7+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
8+
<PlatformTarget>x86</PlatformTarget>
9+
<OutputPath>D:\Unity5Test\bin\</OutputPath>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<ProjectReference Include="..\Interfaces\Interfaces.csproj" />
14+
</ItemGroup>
15+
16+
</Project>
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
namespace Interfaces
4+
{
5+
public interface InterfaceN
6+
{
7+
string GetString();
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
</PropertyGroup>
6+
7+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
8+
<PlatformTarget>x86</PlatformTarget>
9+
<OutputPath>D:\Unity5Test\bin\</OutputPath>
10+
</PropertyGroup>
11+
12+
</Project>

UnityContainer5Test/Test/App.config

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<configSections>
4+
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Unity.Configuration" />
5+
</configSections>
6+
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
7+
<container>
8+
<register
9+
type="Interfaces.InterfaceN, Interfaces"
10+
mapTo="Implementations.ImplementationN, Implementations">
11+
</register>
12+
</container>
13+
</unity>
14+
</configuration>

UnityContainer5Test/Test/Program.cs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using Unity;
3+
using Microsoft.Practices.Unity.Configuration;
4+
using Interfaces;
5+
6+
namespace Test
7+
{
8+
class Program
9+
{
10+
static void Main(string[] args)
11+
{
12+
var container = new UnityContainer().LoadConfiguration();
13+
14+
var type = container.Resolve<InterfaceN>();
15+
16+
Console.WriteLine(type.GetString());
17+
}
18+
}
19+
}

UnityContainer5Test/Test/Test.csproj

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
</PropertyGroup>
7+
8+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
9+
<PlatformTarget>x86</PlatformTarget>
10+
<OutputPath>D:\Unity5Test\bin\</OutputPath>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="Unity.Configuration" Version="5.11.1" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<ProjectReference Include="..\Interfaces\Interfaces.csproj" />
19+
</ItemGroup>
20+
21+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29728.190
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Interfaces", "Interfaces\Interfaces.csproj", "{6E15F68E-CE06-4292-9C60-55DED1663595}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implementations", "Implementations\Implementations.csproj", "{1689E0ED-AD20-4CC3-ADCB-3D61E66C186F}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{A559E006-DB2B-494D-B781-79FB2399E75C}"
11+
EndProject
12+
Global
13+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
14+
Debug|Any CPU = Debug|Any CPU
15+
Release|Any CPU = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{6E15F68E-CE06-4292-9C60-55DED1663595}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{6E15F68E-CE06-4292-9C60-55DED1663595}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{6E15F68E-CE06-4292-9C60-55DED1663595}.Release|Any CPU.ActiveCfg = Release|Any CPU
21+
{6E15F68E-CE06-4292-9C60-55DED1663595}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{1689E0ED-AD20-4CC3-ADCB-3D61E66C186F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{1689E0ED-AD20-4CC3-ADCB-3D61E66C186F}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{1689E0ED-AD20-4CC3-ADCB-3D61E66C186F}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{1689E0ED-AD20-4CC3-ADCB-3D61E66C186F}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{A559E006-DB2B-494D-B781-79FB2399E75C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{A559E006-DB2B-494D-B781-79FB2399E75C}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{A559E006-DB2B-494D-B781-79FB2399E75C}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{A559E006-DB2B-494D-B781-79FB2399E75C}.Release|Any CPU.Build.0 = Release|Any CPU
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) = preSolution
32+
HideSolutionNode = FALSE
33+
EndGlobalSection
34+
GlobalSection(ExtensibilityGlobals) = postSolution
35+
SolutionGuid = {C812F9A2-1BF2-457D-9A7A-67A5E4E48C0A}
36+
EndGlobalSection
37+
EndGlobal

0 commit comments

Comments
 (0)