Skip to content

Commit 4b55b39

Browse files
authored
Spring.FluentContext 2.0 with NetStandard 2.0 (#2)
* migrated to .NET standard 2.0 * Updated projects and renamed conflicting GetObject<T>() to GetDefaultObject<T>()
1 parent f1b7f76 commit 4b55b39

File tree

79 files changed

+220
-315226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+220
-315226
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ obj
55
*.user
66
build/Output
77
*.userprefs
8-
test-results
8+
test-results
9+
.idea
10+
output/
11+
.vs

Changelog.txt

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Spring.FluentContext
22
===========================================
33

4+
Version 2.0.0-pre
5+
-------------------------------------------
6+
+ Updated Spring.Aop/Spring.Core to 2.0.1 for NET 45
7+
+ Added NetStandard 2.0 target, referring to D3S.Spring.Aop/D3S.Spring.Core 3.0.0-pre
8+
+ Renamed GetObject<T>() to GetDefaultObject<T>() to avoid conflict with Spring 2X series
9+
410
Version 1.0.9
511
-------------------------------------------
612
+ Added Def.ObjectProperty() and ToObjectProperty() extension method allowing to retrieve object property value
-75 KB
Binary file not shown.

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Allows creating Spring.NET IoC container from code using fluent API:
88
* with type-safe injections
99
* with possibility to integrate with other contexts (like XML ones) using hierarchical context construction
1010

11+
## Badges
12+
Build: [![Build status](https://ci.appveyor.com/api/projects/status/ustjsudvd27p8rxs/branch/master?svg=true)](https://ci.appveyor.com/project/Suremaker/spring-fluentcontext/branch/master)
13+
14+
Spring.FluentContext: [![NuGet Badge](https://buildstats.info/nuget/Spring.FluentContext?includePreReleases=true)](https://www.nuget.org/packages/Spring.FluentContext/)
15+
1116
## Download
1217
It is possible to download package using [NuGet](http://nuget.org): `PM> Install-Package Spring.FluentContext`
1318

Spring.FluentContext.Examples/CollectionInjection/CollectionInjectionExample.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected override IApplicationContext CreateContext()
4343

4444
protected override void RunExample(IApplicationContext ctx)
4545
{
46-
var factory = ctx.GetObject<Factory>();
46+
var factory = ctx.GetDefaultObject<Factory>();
4747
factory.Create("Car");
4848
factory.Create("Motorcycle");
4949
factory.Create("Luxury Car");

Spring.FluentContext.Examples/Complex/ComplexExample.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected override IApplicationContext CreateContext()
3939

4040
protected override void RunExample(IApplicationContext ctx)
4141
{
42-
var sender = ctx.GetObject<Sender>();
42+
var sender = ctx.GetDefaultObject<Sender>();
4343
sender.Run();
4444
//to let background tasks to finish
4545
Thread.Sleep(3000);

Spring.FluentContext.Examples/ConstructorInjection/ConstructorInjectionExample.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protected override IApplicationContext CreateContext()
2222

2323
protected override void RunExample(IApplicationContext ctx)
2424
{
25-
ctx.GetObject<PersonWithCat>().Introduce();
25+
ctx.GetDefaultObject<PersonWithCat>().Introduce();
2626
}
2727
}
2828
}

Spring.FluentContext.Examples/LookupMethodInjection/LookupMethodInjectionExample.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected override IApplicationContext CreateContext()
2626

2727
protected override void RunExample(IApplicationContext ctx)
2828
{
29-
var calc = ctx.GetObject<ICreditsCalculator>();
29+
var calc = ctx.GetDefaultObject<ICreditsCalculator>();
3030
CalculateCredits(calc, "Josh", 2.4, 4.3, 5.8);
3131
CalculateCredits(calc, "John", 2.4, 1.3, 3.2);
3232
}

Spring.FluentContext.Examples/Properties/AssemblyInfo.cs

-35
This file was deleted.

Spring.FluentContext.Examples/PropertyInjection/PropertyInjectionExample.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected override IApplicationContext CreateContext()
2323

2424
protected override void RunExample(IApplicationContext ctx)
2525
{
26-
ctx.GetObject<Person>().ShowDetails();
26+
ctx.GetDefaultObject<Person>().ShowDetails();
2727
}
2828
}
2929
}

Spring.FluentContext.Examples/ProxyFactoryUsage/ProxyFactoryUsageExample.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protected override IApplicationContext CreateContext()
2222

2323
protected override void RunExample(IApplicationContext ctx)
2424
{
25-
Console.WriteLine("Result = {0}", ctx.GetObject<ICalculator>().Add(3, 5));
25+
Console.WriteLine("Result = {0}", ctx.GetDefaultObject<ICalculator>().Add(3, 5));
2626
}
2727
}
2828
}
Original file line numberDiff line numberDiff line change
@@ -1,163 +1,10 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProductVersion>8.0.30703</ProductVersion>
7-
<SchemaVersion>2.0</SchemaVersion>
8-
<ProjectGuid>{7D461C3F-F00E-4F67-A083-7184ED2E8128}</ProjectGuid>
9-
<OutputType>Exe</OutputType>
10-
<AppDesignerFolder>Properties</AppDesignerFolder>
11-
<RootNamespace>Spring.FluentContext.Examples</RootNamespace>
12-
<AssemblyName>Spring.FluentContext.Examples</AssemblyName>
13-
<FileAlignment>512</FileAlignment>
14-
<PublishUrl>publish\</PublishUrl>
15-
<Install>true</Install>
16-
<InstallFrom>Disk</InstallFrom>
17-
<UpdateEnabled>false</UpdateEnabled>
18-
<UpdateMode>Foreground</UpdateMode>
19-
<UpdateInterval>7</UpdateInterval>
20-
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
21-
<UpdatePeriodically>false</UpdatePeriodically>
22-
<UpdateRequired>false</UpdateRequired>
23-
<MapFileExtensions>true</MapFileExtensions>
24-
<ApplicationRevision>0</ApplicationRevision>
25-
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
26-
<IsWebBootstrapper>false</IsWebBootstrapper>
27-
<UseApplicationTrust>false</UseApplicationTrust>
28-
<BootstrapperEnabled>true</BootstrapperEnabled>
29-
<StartupObject>Spring.FluentContext.Examples.Program</StartupObject>
30-
</PropertyGroup>
31-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
32-
<DebugSymbols>True</DebugSymbols>
33-
<OutputPath>bin\Debug\</OutputPath>
34-
<DefineConstants>DEBUG;TRACE</DefineConstants>
35-
<DebugType>full</DebugType>
36-
<ErrorReport>prompt</ErrorReport>
37-
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
38-
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
39-
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
40-
<WarningLevel>4</WarningLevel>
41-
<Optimize>False</Optimize>
42-
</PropertyGroup>
43-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
44-
<OutputPath>bin\Release\</OutputPath>
45-
<DefineConstants>TRACE</DefineConstants>
46-
<Optimize>True</Optimize>
47-
<DebugType>pdbonly</DebugType>
48-
<PlatformTarget>AnyCPU</PlatformTarget>
49-
<ErrorReport>prompt</ErrorReport>
50-
<WarningLevel>4</WarningLevel>
51-
</PropertyGroup>
52-
<ItemGroup>
53-
<Reference Include="Common.Logging">
54-
<HintPath>..\packages\Common.Logging.1.2.0\lib\1.0\Common.Logging.dll</HintPath>
55-
</Reference>
56-
<Reference Include="Spring.Aop">
57-
<HintPath>..\packages\Spring.Aop.1.3.2\lib\net40\Spring.Aop.dll</HintPath>
58-
</Reference>
59-
<Reference Include="Spring.Core">
60-
<HintPath>..\packages\Spring.Core.1.3.2\lib\net40\Spring.Core.dll</HintPath>
61-
</Reference>
62-
<Reference Include="System" />
63-
</ItemGroup>
64-
<ItemGroup>
65-
<Compile Include="AdvancedLookupMethodInjection\AdvancedLookupMethodInjectionExample.cs" />
66-
<Compile Include="AdvancedLookupMethodInjection\Objects\Barn.cs" />
67-
<Compile Include="AdvancedLookupMethodInjection\Objects\Cow.cs" />
68-
<Compile Include="AdvancedLookupMethodInjection\Objects\Farm.cs" />
69-
<Compile Include="AdvancedLookupMethodInjection\Objects\IAnimal.cs" />
70-
<Compile Include="AdvancedLookupMethodInjection\Objects\IFarm.cs" />
71-
<Compile Include="AdvancedLookupMethodInjection\Objects\IShelter.cs" />
72-
<Compile Include="AdvancedLookupMethodInjection\Objects\Pig.cs" />
73-
<Compile Include="AdvancedLookupMethodInjection\Objects\Pigsty.cs" />
74-
<Compile Include="AdvancedLookupMethodInjection\Objects\Shelter.cs" />
75-
<Compile Include="AdvancedPropertySetterInjection\AdvancedPropertySetterInjectionExample.cs" />
76-
<Compile Include="AdvancedPropertySetterInjection\Objects\BobEngineer.cs" />
77-
<Compile Include="AdvancedPropertySetterInjection\Objects\Factory.cs" />
78-
<Compile Include="AdvancedPropertySetterInjection\Objects\IFactory.cs" />
79-
<Compile Include="AdvancedPropertySetterInjection\Objects\IFactoryEngineer.cs" />
80-
<Compile Include="AdvancedPropertySetterInjection\Objects\RobotEngineer.cs" />
81-
<Compile Include="CollectionInjection\CollectionInjectionExample.cs" />
82-
<Compile Include="CollectionInjection\Objects\Constructor.cs" />
83-
<Compile Include="CollectionInjection\Objects\Distributor.cs" />
84-
<Compile Include="CollectionInjection\Objects\Factory.cs" />
85-
<Compile Include="CollectionInjection\Objects\IWorker.cs" />
86-
<Compile Include="CollectionInjection\Objects\Painter.cs" />
87-
<Compile Include="CollectionInjection\Objects\Polisher.cs" />
88-
<Compile Include="CollectionInjection\Objects\Shop.cs" />
89-
<Compile Include="Complex\ComplexExample.cs" />
90-
<Compile Include="Complex\Objects\Consumer.cs" />
91-
<Compile Include="Complex\Objects\DelayingInterceptor.cs" />
92-
<Compile Include="Complex\Objects\DisplayCommand.cs" />
93-
<Compile Include="Complex\Objects\Endpoint.cs" />
94-
<Compile Include="Complex\Objects\ICommand.cs" />
95-
<Compile Include="Complex\Objects\IEndpoint.cs" />
96-
<Compile Include="Complex\Objects\RepeatingInterceptor.cs" />
97-
<Compile Include="Complex\Objects\Sender.cs" />
98-
<Compile Include="ConstructorInjection\ConstructorInjectionExample.cs" />
99-
<Compile Include="ConstructorInjection\Objects\Cat.cs" />
100-
<Compile Include="ConstructorInjection\Objects\PersonWithCat.cs" />
101-
<Compile Include="Example.cs" />
102-
<Compile Include="LookupMethodInjection\LookupMethodInjectionExample.cs" />
103-
<Compile Include="LookupMethodInjection\Objects\ArithmenticMeanCalculator.cs" />
104-
<Compile Include="LookupMethodInjection\Objects\CreditsCalculator.cs" />
105-
<Compile Include="LookupMethodInjection\Objects\ICreditsCalculator.cs" />
106-
<Compile Include="LookupMethodInjection\Objects\IMeanCalculator.cs" />
107-
<Compile Include="Program.cs" />
108-
<Compile Include="Properties\AssemblyInfo.cs" />
109-
<Compile Include="PropertyInjection\Objects\Address.cs" />
110-
<Compile Include="PropertyInjection\Objects\Person.cs" />
111-
<Compile Include="PropertyInjection\PropertyInjectionExample.cs" />
112-
<Compile Include="ProxyFactoryUsage\Objects\Calculator.cs" />
113-
<Compile Include="ProxyFactoryUsage\Objects\DisplayingInterceptor.cs" />
114-
<Compile Include="ProxyFactoryUsage\Objects\ICalculator.cs" />
115-
<Compile Include="ProxyFactoryUsage\ProxyFactoryUsageExample.cs" />
116-
<Compile Include="VariousCreationMethods\Objects\Button.cs" />
117-
<Compile Include="VariousCreationMethods\Objects\ButtonFactory.cs" />
118-
<Compile Include="VariousCreationMethods\Objects\IWindow.cs" />
119-
<Compile Include="VariousCreationMethods\Objects\Window.cs" />
120-
<Compile Include="VariousCreationMethods\VariousCreationMethodsExample.cs" />
121-
</ItemGroup>
122-
<ItemGroup>
123-
<ProjectReference Include="..\Spring.FluentContext\Spring.FluentContext.csproj">
124-
<Project>{166FE8E4-E3E6-4A01-9D73-890E6E0F31A6}</Project>
125-
<Name>Spring.FluentContext</Name>
126-
</ProjectReference>
127-
</ItemGroup>
128-
<ItemGroup>
129-
<None Include="packages.config" />
130-
</ItemGroup>
131-
<ItemGroup>
132-
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
133-
<Visible>False</Visible>
134-
<ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
135-
<Install>true</Install>
136-
</BootstrapperPackage>
137-
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
138-
<Visible>False</Visible>
139-
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
140-
<Install>false</Install>
141-
</BootstrapperPackage>
142-
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
143-
<Visible>False</Visible>
144-
<ProductName>.NET Framework 3.5 SP1</ProductName>
145-
<Install>false</Install>
146-
</BootstrapperPackage>
147-
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
148-
<Visible>False</Visible>
149-
<ProductName>Windows Installer 3.1</ProductName>
150-
<Install>true</Install>
151-
</BootstrapperPackage>
152-
</ItemGroup>
153-
<ItemGroup />
154-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
155-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
156-
Other similar extension points exist, see Microsoft.Common.targets.
157-
<Target Name="BeforeBuild">
158-
</Target>
159-
<Target Name="AfterBuild">
160-
</Target>
161-
-->
162-
<ItemGroup />
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<TargetFrameworks>net461;netcoreapp2.2</TargetFrameworks>
5+
<Copyright>Copyright © 2012-2019, Wojciech Kotlarski</Copyright>
6+
</PropertyGroup>
7+
<ItemGroup>
8+
<ProjectReference Include="..\Spring.FluentContext\Spring.FluentContext.csproj" />
9+
</ItemGroup>
16310
</Project>

Spring.FluentContext.Examples/VariousCreationMethods/VariousCreationMethodsExample.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected override IApplicationContext CreateContext()
3131

3232
protected override void RunExample(IApplicationContext ctx)
3333
{
34-
ctx.GetObject<IWindow>().SimulateGuiActions();
34+
ctx.GetDefaultObject<IWindow>().SimulateGuiActions();
3535
}
3636
}
3737
}

Spring.FluentContext.Examples/packages.config

-6
This file was deleted.

Spring.FluentContext.UnitTests/FactoryRegistrationTests.cs

+11-11
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void Register_default_proxy_factory()
8888
.TargetingDefault<Calculator>()
8989
.InterceptedByDefault<MultiplingInterceptor>();
9090

91-
Assert.That(_ctx.GetObject<ICalculator>().Add(3, 5), Is.EqualTo(80));
91+
Assert.That(_ctx.GetDefaultObject<ICalculator>().Add(3, 5), Is.EqualTo(80));
9292
}
9393

9494
[Test]
@@ -112,8 +112,8 @@ public void Register_proxy_factory_to_return_prototypes()
112112
.TargetingDefault<Calculator>()
113113
.ReturningPrototypes();
114114

115-
var proxy1 = _ctx.GetObject<ICalculator>();
116-
var proxy2 = _ctx.GetObject<ICalculator>();
115+
var proxy1 = _ctx.GetDefaultObject<ICalculator>();
116+
var proxy2 = _ctx.GetDefaultObject<ICalculator>();
117117

118118
Assert.That(proxy1, Is.Not.SameAs(proxy2));
119119
}
@@ -126,8 +126,8 @@ public void Register_proxy_factory_to_return_singleton()
126126
.TargetingDefault<Calculator>()
127127
.ReturningSingleton();
128128

129-
var proxy1 = _ctx.GetObject<ICalculator>();
130-
var proxy2 = _ctx.GetObject<ICalculator>();
129+
var proxy1 = _ctx.GetDefaultObject<ICalculator>();
130+
var proxy2 = _ctx.GetDefaultObject<ICalculator>();
131131

132132
Assert.That(proxy1, Is.SameAs(proxy2));
133133
}
@@ -139,8 +139,8 @@ public void Proxy_factory_returns_singleton_by_default()
139139
_ctx.RegisterDefaultProxyFactory<ICalculator>()
140140
.TargetingDefault<Calculator>();
141141

142-
var proxy1 = _ctx.GetObject<ICalculator>();
143-
var proxy2 = _ctx.GetObject<ICalculator>();
142+
var proxy1 = _ctx.GetDefaultObject<ICalculator>();
143+
var proxy2 = _ctx.GetDefaultObject<ICalculator>();
144144

145145
Assert.That(proxy1, Is.SameAs(proxy2));
146146
}
@@ -153,7 +153,7 @@ public void Specify_dependency_on_default_object()
153153
_ctx.RegisterDefault<SimpleType>()
154154
.DependingOnDefault<CountingType>();
155155

156-
_ctx.GetObject<SimpleType>();
156+
_ctx.GetDefaultObject<SimpleType>();
157157
Assert.That(CountingType.Count, Is.EqualTo(1));
158158
}
159159

@@ -165,7 +165,7 @@ public void Specify_dependency_on_named_object()
165165
_ctx.RegisterDefault<SimpleType>()
166166
.DependingOn<CountingType>("counting");
167167

168-
_ctx.GetObject<SimpleType>();
168+
_ctx.GetDefaultObject<SimpleType>();
169169
Assert.That(CountingType.Count, Is.EqualTo(1));
170170
}
171171

@@ -177,7 +177,7 @@ public void Specify_dependency_on_uniquely_named_object()
177177
_ctx.RegisterDefault<SimpleType>()
178178
.DependingOn<CountingType>(reference);
179179

180-
_ctx.GetObject<SimpleType>();
180+
_ctx.GetDefaultObject<SimpleType>();
181181
Assert.That(CountingType.Count, Is.EqualTo(1));
182182
}
183183

@@ -194,7 +194,7 @@ public void Specify_multiple_dependencies()
194194
Assert.That(CountingType.Count, Is.EqualTo(0));
195195
Assert.That(OtherCountingType.Count, Is.EqualTo(0));
196196

197-
_ctx.GetObject<SimpleType>();
197+
_ctx.GetDefaultObject<SimpleType>();
198198

199199
Assert.That(CountingType.Count, Is.EqualTo(1));
200200
Assert.That(OtherCountingType.Count, Is.EqualTo(1));

0 commit comments

Comments
 (0)