From 98e8a3c42d0f542f502ef88777a2db8aa8b1cd50 Mon Sep 17 00:00:00 2001 From: Ramon Smits Date: Wed, 24 Feb 2016 20:31:30 +0100 Subject: [PATCH 1/2] Removed Object builders. --- packaging/nuget/objectbuilder.autofac.nuspec | 25 -- .../nuget/objectbuilder.castlewindsor.nuspec | 25 -- packaging/nuget/objectbuilder.ninject.nuspec | 27 -- packaging/nuget/objectbuilder.spring.nuspec | 25 -- .../nuget/objectbuilder.structuremap.nuspec | 25 -- packaging/nuget/objectbuilder.unity.nuspec | 26 -- .../NServiceBus.AcceptanceTests.csproj | 24 - src/NServiceBus.sln | 95 +--- .../ConfigureAutofacBuilder.cs | 35 -- src/ObjectBuilder.Autofac/FodyWeavers.xml | 4 - .../ObjectBuilder.Autofac.csproj | 116 ----- .../Properties/AssemblyInfo.cs | 11 - src/ObjectBuilder.Autofac/packages.config | 8 - .../ConfigureWindsorBuilder.cs | 32 -- ...nstanceActivatorWithDecommissionConcern.cs | 36 -- .../FodyWeavers.xml | 4 - .../NoOpInterpreter.cs | 15 - .../ObjectBuilder.CastleWindsor.csproj | 106 ----- .../Properties/AssemblyInfo.cs | 11 - .../WindsorObjectBuilder.cs | 182 -------- .../packages.config | 9 - .../ConfigureNinjectBuilder.cs | 35 -- src/ObjectBuilder.Ninject/FodyWeavers.xml | 4 - .../IObjectBuilderPropertyHeuristic.cs | 21 - .../Internal/NinjectChildContainer.cs | 64 --- .../Internal/NinjectWhenExtensions.cs | 27 -- .../ObjectBuilderPropertyHeuristic.cs | 73 --- .../NinjectObjectBuilder.cs | 425 ------------------ .../NinjectObjectBuilderExtensions.cs | 49 -- .../ObjectBuilder.Ninject.csproj | 108 ----- .../Properties/AssemblyInfo.cs | 11 - src/ObjectBuilder.Ninject/packages.config | 10 - .../ArbitraryFuncDelegatingFactoryObject.cs | 45 -- src/ObjectBuilder.Spring/ComponentConfig.cs | 25 -- .../ConfigureSpringBuilder.cs | 35 -- src/ObjectBuilder.Spring/FodyWeavers.xml | 4 - .../ObjectBuilder.Spring.csproj | 101 ----- .../Properties/AssemblyInfo.cs | 12 - .../SpringObjectBuilder.cs | 219 --------- src/ObjectBuilder.Spring/packages.config | 9 - .../ConfigureStructureMapBuilder.cs | 33 -- .../FodyWeavers.xml | 4 - .../ObjectBuilder.StructureMap.csproj | 98 ---- .../Properties/AssemblyInfo.cs | 11 - .../StructureMapExtensions.cs | 51 --- .../StructureMapObjectBuilder.cs | 201 --------- .../packages.config | 8 - src/ObjectBuilder.Tests/BuilderFixture.cs | 82 ---- .../ObjectBuilder.Tests.csproj | 124 ----- .../When_building_components.cs | 157 ------- .../When_disposing_the_builder.cs | 112 ----- ...When_querying_for_registered_components.cs | 58 --- .../When_registering_components.cs | 356 --------------- .../When_releasing_components.cs | 48 -- .../When_using_nested_containers.cs | 247 ---------- src/ObjectBuilder.Tests/packages.config | 14 - .../ConfigureUnityBuilder.cs | 30 -- src/ObjectBuilder.Unity/DefaultInstances.cs | 25 -- src/ObjectBuilder.Unity/FodyWeavers.xml | 4 - .../ObjectBuilder.Unity.csproj | 116 ----- .../Properties/AssemblyInfo.cs | 11 - .../PropertyInjectionBuilderStrategy.cs | 62 --- .../PropertyInjectionContainerExtension.cs | 13 - src/ObjectBuilder.Unity/UnityObjectBuilder.cs | 171 ------- src/ObjectBuilder.Unity/packages.config | 10 - 65 files changed, 1 insertion(+), 4163 deletions(-) delete mode 100644 packaging/nuget/objectbuilder.autofac.nuspec delete mode 100644 packaging/nuget/objectbuilder.castlewindsor.nuspec delete mode 100644 packaging/nuget/objectbuilder.ninject.nuspec delete mode 100644 packaging/nuget/objectbuilder.spring.nuspec delete mode 100644 packaging/nuget/objectbuilder.structuremap.nuspec delete mode 100644 packaging/nuget/objectbuilder.unity.nuspec delete mode 100644 src/ObjectBuilder.Autofac/ConfigureAutofacBuilder.cs delete mode 100644 src/ObjectBuilder.Autofac/FodyWeavers.xml delete mode 100644 src/ObjectBuilder.Autofac/ObjectBuilder.Autofac.csproj delete mode 100644 src/ObjectBuilder.Autofac/Properties/AssemblyInfo.cs delete mode 100644 src/ObjectBuilder.Autofac/packages.config delete mode 100644 src/ObjectBuilder.CastleWindsor/ConfigureWindsorBuilder.cs delete mode 100644 src/ObjectBuilder.CastleWindsor/ExternalInstanceActivatorWithDecommissionConcern.cs delete mode 100644 src/ObjectBuilder.CastleWindsor/FodyWeavers.xml delete mode 100644 src/ObjectBuilder.CastleWindsor/NoOpInterpreter.cs delete mode 100644 src/ObjectBuilder.CastleWindsor/ObjectBuilder.CastleWindsor.csproj delete mode 100644 src/ObjectBuilder.CastleWindsor/Properties/AssemblyInfo.cs delete mode 100644 src/ObjectBuilder.CastleWindsor/WindsorObjectBuilder.cs delete mode 100644 src/ObjectBuilder.CastleWindsor/packages.config delete mode 100644 src/ObjectBuilder.Ninject/ConfigureNinjectBuilder.cs delete mode 100644 src/ObjectBuilder.Ninject/FodyWeavers.xml delete mode 100644 src/ObjectBuilder.Ninject/Internal/IObjectBuilderPropertyHeuristic.cs delete mode 100644 src/ObjectBuilder.Ninject/Internal/NinjectChildContainer.cs delete mode 100644 src/ObjectBuilder.Ninject/Internal/NinjectWhenExtensions.cs delete mode 100644 src/ObjectBuilder.Ninject/Internal/ObjectBuilderPropertyHeuristic.cs delete mode 100644 src/ObjectBuilder.Ninject/NinjectObjectBuilder.cs delete mode 100644 src/ObjectBuilder.Ninject/NinjectObjectBuilderExtensions.cs delete mode 100644 src/ObjectBuilder.Ninject/ObjectBuilder.Ninject.csproj delete mode 100644 src/ObjectBuilder.Ninject/Properties/AssemblyInfo.cs delete mode 100644 src/ObjectBuilder.Ninject/packages.config delete mode 100644 src/ObjectBuilder.Spring/ArbitraryFuncDelegatingFactoryObject.cs delete mode 100644 src/ObjectBuilder.Spring/ComponentConfig.cs delete mode 100644 src/ObjectBuilder.Spring/ConfigureSpringBuilder.cs delete mode 100644 src/ObjectBuilder.Spring/FodyWeavers.xml delete mode 100644 src/ObjectBuilder.Spring/ObjectBuilder.Spring.csproj delete mode 100644 src/ObjectBuilder.Spring/Properties/AssemblyInfo.cs delete mode 100644 src/ObjectBuilder.Spring/SpringObjectBuilder.cs delete mode 100644 src/ObjectBuilder.Spring/packages.config delete mode 100644 src/ObjectBuilder.StructureMap/ConfigureStructureMapBuilder.cs delete mode 100644 src/ObjectBuilder.StructureMap/FodyWeavers.xml delete mode 100644 src/ObjectBuilder.StructureMap/ObjectBuilder.StructureMap.csproj delete mode 100644 src/ObjectBuilder.StructureMap/Properties/AssemblyInfo.cs delete mode 100644 src/ObjectBuilder.StructureMap/StructureMapExtensions.cs delete mode 100644 src/ObjectBuilder.StructureMap/StructureMapObjectBuilder.cs delete mode 100644 src/ObjectBuilder.StructureMap/packages.config delete mode 100644 src/ObjectBuilder.Tests/BuilderFixture.cs delete mode 100644 src/ObjectBuilder.Tests/ObjectBuilder.Tests.csproj delete mode 100644 src/ObjectBuilder.Tests/When_building_components.cs delete mode 100644 src/ObjectBuilder.Tests/When_disposing_the_builder.cs delete mode 100644 src/ObjectBuilder.Tests/When_querying_for_registered_components.cs delete mode 100644 src/ObjectBuilder.Tests/When_registering_components.cs delete mode 100644 src/ObjectBuilder.Tests/When_releasing_components.cs delete mode 100644 src/ObjectBuilder.Tests/When_using_nested_containers.cs delete mode 100644 src/ObjectBuilder.Tests/packages.config delete mode 100644 src/ObjectBuilder.Unity/ConfigureUnityBuilder.cs delete mode 100644 src/ObjectBuilder.Unity/DefaultInstances.cs delete mode 100644 src/ObjectBuilder.Unity/FodyWeavers.xml delete mode 100644 src/ObjectBuilder.Unity/ObjectBuilder.Unity.csproj delete mode 100644 src/ObjectBuilder.Unity/Properties/AssemblyInfo.cs delete mode 100644 src/ObjectBuilder.Unity/PropertyInjectionBuilderStrategy.cs delete mode 100644 src/ObjectBuilder.Unity/PropertyInjectionContainerExtension.cs delete mode 100644 src/ObjectBuilder.Unity/UnityObjectBuilder.cs delete mode 100644 src/ObjectBuilder.Unity/packages.config diff --git a/packaging/nuget/objectbuilder.autofac.nuspec b/packaging/nuget/objectbuilder.autofac.nuspec deleted file mode 100644 index 553d1f5780f..00000000000 --- a/packaging/nuget/objectbuilder.autofac.nuspec +++ /dev/null @@ -1,25 +0,0 @@ - - - - NServiceBus.Autofac - NServiceBus Autofac - $version$ - NServiceBus Ltd - NServiceBus Ltd - http://particular.net/LicenseAgreement - http://particular.net/ - http://s3.amazonaws.com/nuget.images/NServiceBus_32.png - true - The Autofac Container for the nservicebus - - Copyright 2010-2014 NServiceBus. All rights reserved - nservicebus servicebus msmq cqrs publish subscribe - - - - - - - - - \ No newline at end of file diff --git a/packaging/nuget/objectbuilder.castlewindsor.nuspec b/packaging/nuget/objectbuilder.castlewindsor.nuspec deleted file mode 100644 index b1b5a75aee1..00000000000 --- a/packaging/nuget/objectbuilder.castlewindsor.nuspec +++ /dev/null @@ -1,25 +0,0 @@ - - - - NServiceBus.CastleWindsor - NServiceBus CastleWindsor - $version$ - NServiceBus Ltd - NServiceBus Ltd - http://particular.net/LicenseAgreement - http://particular.net/ - http://s3.amazonaws.com/nuget.images/NServiceBus_32.png - true - The CastleWindsor Container for the nservicebus - - Copyright 2010-2014 NServiceBus. All rights reserved - nservicebus servicebus msmq cqrs publish subscribe - - - - - - - - - \ No newline at end of file diff --git a/packaging/nuget/objectbuilder.ninject.nuspec b/packaging/nuget/objectbuilder.ninject.nuspec deleted file mode 100644 index 67e196ad1d4..00000000000 --- a/packaging/nuget/objectbuilder.ninject.nuspec +++ /dev/null @@ -1,27 +0,0 @@ - - - - NServiceBus.Ninject - NServiceBus Ninject - $version$ - NServiceBus Ltd - NServiceBus Ltd - http://particular.net/LicenseAgreement - http://particular.net/ - http://s3.amazonaws.com/nuget.images/NServiceBus_32.png - true - The Ninject Container for the nservicebus - - Copyright 2010-2014 NServiceBus. All rights reserved - nservicebus servicebus msmq cqrs publish subscribe - - - - - - - - - - - \ No newline at end of file diff --git a/packaging/nuget/objectbuilder.spring.nuspec b/packaging/nuget/objectbuilder.spring.nuspec deleted file mode 100644 index 64ace6bf147..00000000000 --- a/packaging/nuget/objectbuilder.spring.nuspec +++ /dev/null @@ -1,25 +0,0 @@ - - - - NServiceBus.Spring - NServiceBus Spring - $version$ - NServiceBus Ltd - NServiceBus Ltd - http://particular.net/LicenseAgreement - http://particular.net/ - http://s3.amazonaws.com/nuget.images/NServiceBus_32.png - true - The Spring Container for the nservicebus - - Copyright 2010-2014 NServiceBus. All rights reserved - nservicebus servicebus msmq cqrs publish subscribe - - - - - - - - - \ No newline at end of file diff --git a/packaging/nuget/objectbuilder.structuremap.nuspec b/packaging/nuget/objectbuilder.structuremap.nuspec deleted file mode 100644 index 3a1ada157df..00000000000 --- a/packaging/nuget/objectbuilder.structuremap.nuspec +++ /dev/null @@ -1,25 +0,0 @@ - - - - NServiceBus.StructureMap - NServiceBus StructureMap - $version$ - NServiceBus Ltd - NServiceBus Ltd - http://particular.net/LicenseAgreement - http://particular.net/ - http://s3.amazonaws.com/nuget.images/NServiceBus_32.png - true - The StructureMap Container for the nservicebus - - Copyright 2010-2014 NServiceBus. All rights reserved - nservicebus servicebus msmq cqrs publish subscribe - - - - - - - - - \ No newline at end of file diff --git a/packaging/nuget/objectbuilder.unity.nuspec b/packaging/nuget/objectbuilder.unity.nuspec deleted file mode 100644 index c562fc739de..00000000000 --- a/packaging/nuget/objectbuilder.unity.nuspec +++ /dev/null @@ -1,26 +0,0 @@ - - - - NServiceBus.Unity - NServiceBus Unity - $version$ - NServiceBus Ltd - NServiceBus Ltd - http://particular.net/LicenseAgreement - http://particular.net/ - http://s3.amazonaws.com/nuget.images/NServiceBus_32.png - true - The Unity Container for the nservicebus - - Copyright 2010-2014 NServiceBus. All rights reserved - nservicebus servicebus msmq cqrs publish subscribe - - - - - - - - - - \ No newline at end of file diff --git a/src/NServiceBus.AcceptanceTests/NServiceBus.AcceptanceTests.csproj b/src/NServiceBus.AcceptanceTests/NServiceBus.AcceptanceTests.csproj index ae74570100c..8e84eef3652 100644 --- a/src/NServiceBus.AcceptanceTests/NServiceBus.AcceptanceTests.csproj +++ b/src/NServiceBus.AcceptanceTests/NServiceBus.AcceptanceTests.csproj @@ -235,30 +235,6 @@ - - {73ec4ebe-826d-4a0a-8837-51d3458fc2a8} - ObjectBuilder.Autofac - - - {9a9a0bd5-ac37-4b90-b90f-fd1c1395febd} - ObjectBuilder.CastleWindsor - - - {c35ae1c7-c785-4629-a73d-977e0325d8b0} - ObjectBuilder.Ninject - - - {734d30cf-4376-488a-a6b4-1033fed93660} - ObjectBuilder.Spring - - - {c05e5b87-eb74-4a3f-b4fc-afdd28570850} - ObjectBuilder.StructureMap - - - {343b2e7a-e228-4b31-abb5-f5437b2e7a4c} - ObjectBuilder.Unity - {dd48b2d0-e996-412d-9157-821ed8b17a9d} NServiceBus.Core diff --git a/src/NServiceBus.sln b/src/NServiceBus.sln index 7cb5881a09a..7e09e88a31d 100644 --- a/src/NServiceBus.sln +++ b/src/NServiceBus.sln @@ -1,23 +1,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30723.0 +VisualStudioVersion = 12.0.40629.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NServiceBus", "NServiceBus\NServiceBus.csproj", "{73867D40-8CBB-48E9-BFFA-12BBDD48A341}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObjectBuilder.CastleWindsor", "ObjectBuilder.CastleWindsor\ObjectBuilder.CastleWindsor.csproj", "{9A9A0BD5-AC37-4B90-B90F-FD1C1395FEBD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObjectBuilder.StructureMap", "ObjectBuilder.StructureMap\ObjectBuilder.StructureMap.csproj", "{C05E5B87-EB74-4A3F-B4FC-AFDD28570850}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObjectBuilder.Autofac", "ObjectBuilder.Autofac\ObjectBuilder.Autofac.csproj", "{73EC4EBE-826D-4A0A-8837-51D3458FC2A8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObjectBuilder.Unity", "ObjectBuilder.Unity\ObjectBuilder.Unity.csproj", "{343B2E7A-E228-4B31-ABB5-F5437B2E7A4C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObjectBuilder.Tests", "ObjectBuilder.Tests\ObjectBuilder.Tests.csproj", "{0A282BF4-0957-4074-8D5E-C2FB8634A3AA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObjectBuilder.Spring", "ObjectBuilder.Spring\ObjectBuilder.Spring.csproj", "{734D30CF-4376-488A-A6B4-1033FED93660}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObjectBuilder.Ninject", "ObjectBuilder.Ninject\ObjectBuilder.Ninject.csproj", "{C35AE1C7-C785-4629-A73D-977E0325D8B0}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NServiceBus.SagaPersisters.InMemory.Tests", "NServiceBus.SagaPersisters.InMemory.Tests\NServiceBus.SagaPersisters.InMemory.Tests.csproj", "{BEC0A9DD-B275-4B62-BF61-22E25B593DB1}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NServiceBus.Serializers.XML.XsdGenerator", "NServiceBus.Serializers.XML.XsdGenerator\NServiceBus.Serializers.XML.XsdGenerator.csproj", "{85118B5C-6CAA-44B4-87EA-419DC6F4F2FB}" @@ -26,8 +12,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NServiceBus.Logging.Tests", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{258A3F0E-FAFA-4C13-9D5A-9E46661B22D2}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ObjectBuilders", "ObjectBuilders", "{A650DE92-3B6D-4228-A1A2-FB06E74C1BD2}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{2904B75F-8F07-4C07-BABC-BC42533B3E75}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{EF5E77D7-74B1-422D-B34E-AED35E19249E}" @@ -92,76 +76,6 @@ Global {73867D40-8CBB-48E9-BFFA-12BBDD48A341}.Release|Mixed Platforms.Build.0 = Release|Any CPU {73867D40-8CBB-48E9-BFFA-12BBDD48A341}.Release|x86.ActiveCfg = Release|Any CPU {73867D40-8CBB-48E9-BFFA-12BBDD48A341}.Release|x86.Build.0 = Release|Any CPU - {9A9A0BD5-AC37-4B90-B90F-FD1C1395FEBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A9A0BD5-AC37-4B90-B90F-FD1C1395FEBD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9A9A0BD5-AC37-4B90-B90F-FD1C1395FEBD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {9A9A0BD5-AC37-4B90-B90F-FD1C1395FEBD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {9A9A0BD5-AC37-4B90-B90F-FD1C1395FEBD}.Debug|x86.ActiveCfg = Debug|Any CPU - {9A9A0BD5-AC37-4B90-B90F-FD1C1395FEBD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9A9A0BD5-AC37-4B90-B90F-FD1C1395FEBD}.Release|Any CPU.Build.0 = Release|Any CPU - {9A9A0BD5-AC37-4B90-B90F-FD1C1395FEBD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {9A9A0BD5-AC37-4B90-B90F-FD1C1395FEBD}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {9A9A0BD5-AC37-4B90-B90F-FD1C1395FEBD}.Release|x86.ActiveCfg = Release|Any CPU - {C05E5B87-EB74-4A3F-B4FC-AFDD28570850}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C05E5B87-EB74-4A3F-B4FC-AFDD28570850}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C05E5B87-EB74-4A3F-B4FC-AFDD28570850}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {C05E5B87-EB74-4A3F-B4FC-AFDD28570850}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {C05E5B87-EB74-4A3F-B4FC-AFDD28570850}.Debug|x86.ActiveCfg = Debug|Any CPU - {C05E5B87-EB74-4A3F-B4FC-AFDD28570850}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C05E5B87-EB74-4A3F-B4FC-AFDD28570850}.Release|Any CPU.Build.0 = Release|Any CPU - {C05E5B87-EB74-4A3F-B4FC-AFDD28570850}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {C05E5B87-EB74-4A3F-B4FC-AFDD28570850}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {C05E5B87-EB74-4A3F-B4FC-AFDD28570850}.Release|x86.ActiveCfg = Release|Any CPU - {73EC4EBE-826D-4A0A-8837-51D3458FC2A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {73EC4EBE-826D-4A0A-8837-51D3458FC2A8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {73EC4EBE-826D-4A0A-8837-51D3458FC2A8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {73EC4EBE-826D-4A0A-8837-51D3458FC2A8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {73EC4EBE-826D-4A0A-8837-51D3458FC2A8}.Debug|x86.ActiveCfg = Debug|Any CPU - {73EC4EBE-826D-4A0A-8837-51D3458FC2A8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {73EC4EBE-826D-4A0A-8837-51D3458FC2A8}.Release|Any CPU.Build.0 = Release|Any CPU - {73EC4EBE-826D-4A0A-8837-51D3458FC2A8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {73EC4EBE-826D-4A0A-8837-51D3458FC2A8}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {73EC4EBE-826D-4A0A-8837-51D3458FC2A8}.Release|x86.ActiveCfg = Release|Any CPU - {343B2E7A-E228-4B31-ABB5-F5437B2E7A4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {343B2E7A-E228-4B31-ABB5-F5437B2E7A4C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {343B2E7A-E228-4B31-ABB5-F5437B2E7A4C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {343B2E7A-E228-4B31-ABB5-F5437B2E7A4C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {343B2E7A-E228-4B31-ABB5-F5437B2E7A4C}.Debug|x86.ActiveCfg = Debug|Any CPU - {343B2E7A-E228-4B31-ABB5-F5437B2E7A4C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {343B2E7A-E228-4B31-ABB5-F5437B2E7A4C}.Release|Any CPU.Build.0 = Release|Any CPU - {343B2E7A-E228-4B31-ABB5-F5437B2E7A4C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {343B2E7A-E228-4B31-ABB5-F5437B2E7A4C}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {343B2E7A-E228-4B31-ABB5-F5437B2E7A4C}.Release|x86.ActiveCfg = Release|Any CPU - {0A282BF4-0957-4074-8D5E-C2FB8634A3AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0A282BF4-0957-4074-8D5E-C2FB8634A3AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0A282BF4-0957-4074-8D5E-C2FB8634A3AA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {0A282BF4-0957-4074-8D5E-C2FB8634A3AA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {0A282BF4-0957-4074-8D5E-C2FB8634A3AA}.Debug|x86.ActiveCfg = Debug|Any CPU - {0A282BF4-0957-4074-8D5E-C2FB8634A3AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0A282BF4-0957-4074-8D5E-C2FB8634A3AA}.Release|Any CPU.Build.0 = Release|Any CPU - {0A282BF4-0957-4074-8D5E-C2FB8634A3AA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {0A282BF4-0957-4074-8D5E-C2FB8634A3AA}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {0A282BF4-0957-4074-8D5E-C2FB8634A3AA}.Release|x86.ActiveCfg = Release|Any CPU - {734D30CF-4376-488A-A6B4-1033FED93660}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {734D30CF-4376-488A-A6B4-1033FED93660}.Debug|Any CPU.Build.0 = Debug|Any CPU - {734D30CF-4376-488A-A6B4-1033FED93660}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {734D30CF-4376-488A-A6B4-1033FED93660}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {734D30CF-4376-488A-A6B4-1033FED93660}.Debug|x86.ActiveCfg = Debug|Any CPU - {734D30CF-4376-488A-A6B4-1033FED93660}.Release|Any CPU.ActiveCfg = Release|Any CPU - {734D30CF-4376-488A-A6B4-1033FED93660}.Release|Any CPU.Build.0 = Release|Any CPU - {734D30CF-4376-488A-A6B4-1033FED93660}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {734D30CF-4376-488A-A6B4-1033FED93660}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {734D30CF-4376-488A-A6B4-1033FED93660}.Release|x86.ActiveCfg = Release|Any CPU - {C35AE1C7-C785-4629-A73D-977E0325D8B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C35AE1C7-C785-4629-A73D-977E0325D8B0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C35AE1C7-C785-4629-A73D-977E0325D8B0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {C35AE1C7-C785-4629-A73D-977E0325D8B0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {C35AE1C7-C785-4629-A73D-977E0325D8B0}.Debug|x86.ActiveCfg = Debug|Any CPU - {C35AE1C7-C785-4629-A73D-977E0325D8B0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C35AE1C7-C785-4629-A73D-977E0325D8B0}.Release|Any CPU.Build.0 = Release|Any CPU - {C35AE1C7-C785-4629-A73D-977E0325D8B0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {C35AE1C7-C785-4629-A73D-977E0325D8B0}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {C35AE1C7-C785-4629-A73D-977E0325D8B0}.Release|x86.ActiveCfg = Release|Any CPU {BEC0A9DD-B275-4B62-BF61-22E25B593DB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BEC0A9DD-B275-4B62-BF61-22E25B593DB1}.Debug|Any CPU.Build.0 = Debug|Any CPU {BEC0A9DD-B275-4B62-BF61-22E25B593DB1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -330,13 +244,6 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {73867D40-8CBB-48E9-BFFA-12BBDD48A341} = {258A3F0E-FAFA-4C13-9D5A-9E46661B22D2} - {9A9A0BD5-AC37-4B90-B90F-FD1C1395FEBD} = {A650DE92-3B6D-4228-A1A2-FB06E74C1BD2} - {C05E5B87-EB74-4A3F-B4FC-AFDD28570850} = {A650DE92-3B6D-4228-A1A2-FB06E74C1BD2} - {73EC4EBE-826D-4A0A-8837-51D3458FC2A8} = {A650DE92-3B6D-4228-A1A2-FB06E74C1BD2} - {343B2E7A-E228-4B31-ABB5-F5437B2E7A4C} = {A650DE92-3B6D-4228-A1A2-FB06E74C1BD2} - {0A282BF4-0957-4074-8D5E-C2FB8634A3AA} = {A650DE92-3B6D-4228-A1A2-FB06E74C1BD2} - {734D30CF-4376-488A-A6B4-1033FED93660} = {A650DE92-3B6D-4228-A1A2-FB06E74C1BD2} - {C35AE1C7-C785-4629-A73D-977E0325D8B0} = {A650DE92-3B6D-4228-A1A2-FB06E74C1BD2} {BEC0A9DD-B275-4B62-BF61-22E25B593DB1} = {258A3F0E-FAFA-4C13-9D5A-9E46661B22D2} {85118B5C-6CAA-44B4-87EA-419DC6F4F2FB} = {EF5E77D7-74B1-422D-B34E-AED35E19249E} {CED929E4-5D17-4A5F-B74C-648331FF7E7A} = {258A3F0E-FAFA-4C13-9D5A-9E46661B22D2} diff --git a/src/ObjectBuilder.Autofac/ConfigureAutofacBuilder.cs b/src/ObjectBuilder.Autofac/ConfigureAutofacBuilder.cs deleted file mode 100644 index 3f2fd919328..00000000000 --- a/src/ObjectBuilder.Autofac/ConfigureAutofacBuilder.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace NServiceBus -{ - using Autofac; - using ObjectBuilder.Autofac; - using ObjectBuilder.Common.Config; - - /// - /// Contains extension methods to . - /// - public static class ConfigureAutofacBuilder - { - /// - /// Use the Autofac builder. - /// - /// The configuration context. - /// The configuration context. - public static Configure AutofacBuilder(this Configure config) - { - ConfigureCommon.With(config, new AutofacObjectBuilder()); - return config; - } - - /// - /// Use the Autofac builder passing in a pre-configured container to be used by nServiceBus. - /// - /// The configuration context. - /// The root-most lifetime scope. - /// The configuration context. - public static Configure AutofacBuilder(this Configure config, ILifetimeScope rootScope) - { - ConfigureCommon.With(config, new AutofacObjectBuilder(rootScope)); - return config; - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Autofac/FodyWeavers.xml b/src/ObjectBuilder.Autofac/FodyWeavers.xml deleted file mode 100644 index 7172ab76b3b..00000000000 --- a/src/ObjectBuilder.Autofac/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Autofac/ObjectBuilder.Autofac.csproj b/src/ObjectBuilder.Autofac/ObjectBuilder.Autofac.csproj deleted file mode 100644 index da640ae2288..00000000000 --- a/src/ObjectBuilder.Autofac/ObjectBuilder.Autofac.csproj +++ /dev/null @@ -1,116 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {73EC4EBE-826D-4A0A-8837-51D3458FC2A8} - Library - Properties - NServiceBus.ObjectBuilder.Autofac - NServiceBus.ObjectBuilder.Autofac - v4.0 - 512 - true - ..\NServiceBus.snk - ..\ - - - - - true - full - false - ..\..\binaries\containers\autofac\ - DEBUG;TRACE - prompt - 4 - ..\..\binaries\NServiceBus.ObjectBuilder.Autofac.xml - AllRules.ruleset - true - 1591 - - - pdbonly - true - ..\..\binaries\containers\autofac\ - TRACE - prompt - 4 - ..\..\binaries\NServiceBus.ObjectBuilder.Autofac.xml - AllRules.ruleset - true - 1591 - - - - False - ..\packages\Autofac.3.1.5\lib\net40\Autofac.dll - - - False - ..\packages\Janitor.Fody.1.1.0.0\Lib\portable-net4+sl5+wp8+win8+wpa81+MonoAndroid16+MonoTouch40\Janitor.dll - False - - - - - - - - AutofacObjectBuilder.cs - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - - {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus - False - - - {DD48B2D0-E996-412D-9157-821ED8B17A9D} - NServiceBus.Core - False - - - - - - - - Designer - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Autofac/Properties/AssemblyInfo.cs b/src/ObjectBuilder.Autofac/Properties/AssemblyInfo.cs deleted file mode 100644 index 192186459f8..00000000000 --- a/src/ObjectBuilder.Autofac/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("NServiceBus Container Autofac Implementation")] -[assembly: AssemblyDescription("Implementation of container functionality on top of Autofac.")] -[assembly: AssemblyCopyright("Copyright 2010-2014 NServiceBus. All rights reserved")] -[assembly: AssemblyProduct("NServiceBus")] -[assembly: AssemblyCompany("NServiceBus Ltd.")] -[assembly: ComVisible(false)] -[assembly: CLSCompliant(true)] \ No newline at end of file diff --git a/src/ObjectBuilder.Autofac/packages.config b/src/ObjectBuilder.Autofac/packages.config deleted file mode 100644 index bb15073e027..00000000000 --- a/src/ObjectBuilder.Autofac/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.CastleWindsor/ConfigureWindsorBuilder.cs b/src/ObjectBuilder.CastleWindsor/ConfigureWindsorBuilder.cs deleted file mode 100644 index 1466b408726..00000000000 --- a/src/ObjectBuilder.CastleWindsor/ConfigureWindsorBuilder.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace NServiceBus -{ - using Castle.Windsor; - using ObjectBuilder.CastleWindsor; - using ObjectBuilder.Common.Config; - - /// - /// Contains extension methods to NServiceBus.Configure. - /// - public static class ConfigureWindsorBuilder - { - /// - /// Use the Castle Windsor builder. - /// - public static Configure CastleWindsorBuilder(this Configure config) - { - ConfigureCommon.With(config, new WindsorObjectBuilder()); - - return config; - } - - /// - /// Use the Castle Windsor builder passing in a pre-configured container to be used by nServiceBus. - /// - public static Configure CastleWindsorBuilder(this Configure config, IWindsorContainer container) - { - ConfigureCommon.With(config, new WindsorObjectBuilder(container)); - - return config; - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.CastleWindsor/ExternalInstanceActivatorWithDecommissionConcern.cs b/src/ObjectBuilder.CastleWindsor/ExternalInstanceActivatorWithDecommissionConcern.cs deleted file mode 100644 index be64525c6a7..00000000000 --- a/src/ObjectBuilder.CastleWindsor/ExternalInstanceActivatorWithDecommissionConcern.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace NServiceBus.ObjectBuilder.CastleWindsor -{ - using Castle.Core; - using Castle.MicroKernel; - using Castle.MicroKernel.ComponentActivator; - using Castle.MicroKernel.Context; - - class ExternalInstanceActivatorWithDecommissionConcern : AbstractComponentActivator, IDependencyAwareActivator - { - public ExternalInstanceActivatorWithDecommissionConcern(ComponentModel model, IKernelInternal kernel, ComponentInstanceDelegate onCreation, ComponentInstanceDelegate onDestruction) - : base(model, kernel, onCreation, onDestruction) - { - } - - public bool CanProvideRequiredDependencies(ComponentModel component) - { - //we already have an instance so we don't need to provide any dependencies at all - return true; - } - - public bool IsManagedExternally(ComponentModel component) - { - return false; - } - - protected override object InternalCreate(CreationContext context) - { - return Model.ExtendedProperties["instance"]; - } - - protected override void InternalDestroy(object instance) - { - ApplyDecommissionConcerns(instance); - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.CastleWindsor/FodyWeavers.xml b/src/ObjectBuilder.CastleWindsor/FodyWeavers.xml deleted file mode 100644 index 7172ab76b3b..00000000000 --- a/src/ObjectBuilder.CastleWindsor/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.CastleWindsor/NoOpInterpreter.cs b/src/ObjectBuilder.CastleWindsor/NoOpInterpreter.cs deleted file mode 100644 index 3117dbb0c8a..00000000000 --- a/src/ObjectBuilder.CastleWindsor/NoOpInterpreter.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace NServiceBus.ObjectBuilder.CastleWindsor -{ - using Castle.Core.Resource; - using Castle.MicroKernel; - using Castle.MicroKernel.SubSystems.Configuration; - using Castle.Windsor.Configuration.Interpreters; - - class NoOpInterpreter : AbstractInterpreter - { - public override void ProcessResource(IResource resource, IConfigurationStore store, IKernel kernel) - { - - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.CastleWindsor/ObjectBuilder.CastleWindsor.csproj b/src/ObjectBuilder.CastleWindsor/ObjectBuilder.CastleWindsor.csproj deleted file mode 100644 index 5e99804b51e..00000000000 --- a/src/ObjectBuilder.CastleWindsor/ObjectBuilder.CastleWindsor.csproj +++ /dev/null @@ -1,106 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {9A9A0BD5-AC37-4B90-B90F-FD1C1395FEBD} - Library - Properties - NServiceBus.ObjectBuilder.CastleWindsor - NServiceBus.ObjectBuilder.CastleWindsor - v4.0 - 512 - true - ..\NServiceBus.snk - ..\ - - - - - true - full - false - ..\..\binaries\containers\castle\ - TRACE;DEBUG - prompt - 4 - ..\..\binaries\containers\castle\NServiceBus.ObjectBuilder.CastleWindsor.xml - AllRules.ruleset - 1591,1573 - true - - - pdbonly - true - ..\..\binaries\containers\castle\ - TRACE - prompt - 4 - ..\..\binaries\containers\castle\NServiceBus.ObjectBuilder.CastleWindsor.xml - AllRules.ruleset - 1591,1573 - true - - - - False - ..\packages\Castle.Core.3.2.1\lib\net40-client\Castle.Core.dll - - - False - ..\packages\Castle.Windsor.3.2.1\lib\net40\Castle.Windsor.dll - - - False - ..\packages\Janitor.Fody.1.1.0.0\Lib\portable-net4+sl5+wp8+win8+wpa81+MonoAndroid16+MonoTouch40\Janitor.dll - False - - - - - - - - - - - - - - - - - - {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus - False - - - {DD48B2D0-E996-412D-9157-821ED8B17A9D} - NServiceBus.Core - False - - - - - - - - Designer - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.CastleWindsor/Properties/AssemblyInfo.cs b/src/ObjectBuilder.CastleWindsor/Properties/AssemblyInfo.cs deleted file mode 100644 index c21f96f42fe..00000000000 --- a/src/ObjectBuilder.CastleWindsor/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("NServiceBus Object Builder Castle Implementation")] -[assembly: AssemblyDescription("Implementation of object building functionality on top of Castle Windsor.")] -[assembly: AssemblyCopyright("Copyright 2010-2014 NServiceBus. All rights reserved")] -[assembly: AssemblyProduct("NServiceBus")] -[assembly: AssemblyCompany("NServiceBus Ltd.")] -[assembly: ComVisible(false)] -[assembly: CLSCompliant(true)] \ No newline at end of file diff --git a/src/ObjectBuilder.CastleWindsor/WindsorObjectBuilder.cs b/src/ObjectBuilder.CastleWindsor/WindsorObjectBuilder.cs deleted file mode 100644 index d4f52801acf..00000000000 --- a/src/ObjectBuilder.CastleWindsor/WindsorObjectBuilder.cs +++ /dev/null @@ -1,182 +0,0 @@ -namespace NServiceBus.ObjectBuilder.CastleWindsor -{ - using System; - using System.Collections.Generic; - using System.Linq; - using Castle.Core; - using Castle.MicroKernel.Lifestyle; - using Castle.MicroKernel.Registration; - using Castle.Windsor; - using Common; - using Logging; - - /// - /// Castle Windsor implementation of IContainer. - /// - public class WindsorObjectBuilder : IContainer - { - IWindsorContainer container; - IDisposable scope; - static ILog Logger = LogManager.GetLogger(typeof(WindsorObjectBuilder)); - - /// - /// Instantiates the class with a new WindsorContainer. - /// - public WindsorObjectBuilder() - : this(new WindsorContainer()) - { - } - - /// - /// Instantiates the class saving the given container. - /// - public WindsorObjectBuilder(IWindsorContainer container) - { - if (container == null) - { - throw new ArgumentNullException("container", "The object builder must be initialized with a valid windsor container"); - } - - this.container = container; - } - - public void Dispose() - { - //Injected at compile time - } - - void DisposeManaged() - { - //if we are in a child scope dispose of that but not the parent container - if (scope != null) - { - scope.Dispose(); - return; - } - if (container != null) - { - container.Dispose(); - } - } - - - /// - /// Returns a child instance of the container to facilitate deterministic disposal - /// of all resources built by the child container. - /// - public IContainer BuildChildContainer() - { - return new WindsorObjectBuilder(container) - { - scope = container.Kernel.BeginScope() - }; - } - - - void IContainer.Configure(Type concreteComponent, DependencyLifecycle dependencyLifecycle) - { - var registrations = container.Kernel.GetAssignableHandlers(concreteComponent).Select(x=>x.ComponentModel); - - if (registrations.Any()) - { - Logger.Info("Component " + concreteComponent.FullName + " was already registered in the container."); - return; - } - - var lifestyle = GetLifestyleTypeFrom(dependencyLifecycle); - var services = GetAllServiceTypesFor(concreteComponent); - - container.Register(Component.For(services).ImplementedBy(concreteComponent).LifeStyle.Is(lifestyle)); - } - - void IContainer.Configure(Func componentFactory, DependencyLifecycle dependencyLifecycle) - { - var componentType = typeof (T); - var registrations = container.Kernel.GetAssignableHandlers(componentType).Select(x => x.ComponentModel); - - if (registrations.Any()) - { - Logger.Info("Component " + componentType.FullName + " was already registered in the container."); - return; - } - - var lifestyle = GetLifestyleTypeFrom(dependencyLifecycle); - var services = GetAllServiceTypesFor(componentType); - - container.Register(Component.For(services).UsingFactoryMethod(componentFactory).LifeStyle.Is(lifestyle)); - } - - void IContainer.ConfigureProperty(Type component, string property, object value) - { - var registration = container.Kernel.GetAssignableHandlers(component).Select(x => x.ComponentModel).SingleOrDefault(); - - if (registration == null) - { - var message = "Cannot configure property for a type which hadn't been configured yet. Please call 'Configure' first."; - throw new InvalidOperationException(message); - } - - var dependency = Property.ForKey(property).Eq(value); - registration.CustomDependencies[dependency.Key] = dependency.Value; - } - - void IContainer.RegisterSingleton(Type lookupType, object instance) - { - var registration = container.Kernel.GetAssignableHandlers(lookupType).Select(x => x.ComponentModel).FirstOrDefault(); - - if (registration != null) - { - registration.ExtendedProperties["instance"] = instance; - return; - } - - var services = GetAllServiceTypesFor( instance.GetType() ).Union( new[] { lookupType } ); - - container.Register(Component.For(services).Activator().Instance(instance).LifestyleSingleton()); - } - - object IContainer.Build(Type typeToBuild) - { - return container.Resolve(typeToBuild); - } - - IEnumerable IContainer.BuildAll(Type typeToBuild) - { - return container.ResolveAll(typeToBuild).Cast(); - } - - bool IContainer.HasComponent(Type componentType) - { - return container.Kernel.HasComponent(componentType); - } - - void IContainer.Release(object instance) - { - container.Release(instance); - } - - static LifestyleType GetLifestyleTypeFrom(DependencyLifecycle dependencyLifecycle) - { - switch (dependencyLifecycle) - { - case DependencyLifecycle.InstancePerCall: - return LifestyleType.Transient; - case DependencyLifecycle.SingleInstance: - return LifestyleType.Singleton; - case DependencyLifecycle.InstancePerUnitOfWork: - return LifestyleType.Scoped; - } - - throw new ArgumentException("Unhandled lifecycle - " + dependencyLifecycle); - } - - static IEnumerable GetAllServiceTypesFor(Type t) - { - return t.GetInterfaces() - .Where(x => !x.FullName.StartsWith("System.")) - .Concat(new[] {t}); - } - - - } -} diff --git a/src/ObjectBuilder.CastleWindsor/packages.config b/src/ObjectBuilder.CastleWindsor/packages.config deleted file mode 100644 index 618a8ffe69c..00000000000 --- a/src/ObjectBuilder.CastleWindsor/packages.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Ninject/ConfigureNinjectBuilder.cs b/src/ObjectBuilder.Ninject/ConfigureNinjectBuilder.cs deleted file mode 100644 index 5417d9816d8..00000000000 --- a/src/ObjectBuilder.Ninject/ConfigureNinjectBuilder.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace NServiceBus -{ - using Ninject; - using ObjectBuilder.Common.Config; - using ObjectBuilder.Ninject; - - /// - /// The static class which holds extensions methods. - /// - public static class ConfigureNinjectBuilder - { - /// - /// Instructs to use the provided kernel - /// - /// The extended Configure. - /// The Configure. - public static Configure NinjectBuilder(this Configure config) - { - ConfigureCommon.With(config, new NinjectObjectBuilder()); - return config; - } - - /// - /// Instructs to use the provided kernel - /// - /// The extended Configure. - /// The kernel. - /// The Configure. - public static Configure NinjectBuilder(this Configure config, IKernel kernel) - { - ConfigureCommon.With(config, new NinjectObjectBuilder(kernel)); - return config; - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Ninject/FodyWeavers.xml b/src/ObjectBuilder.Ninject/FodyWeavers.xml deleted file mode 100644 index 7172ab76b3b..00000000000 --- a/src/ObjectBuilder.Ninject/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Ninject/Internal/IObjectBuilderPropertyHeuristic.cs b/src/ObjectBuilder.Ninject/Internal/IObjectBuilderPropertyHeuristic.cs deleted file mode 100644 index 4bc74e7b3cc..00000000000 --- a/src/ObjectBuilder.Ninject/Internal/IObjectBuilderPropertyHeuristic.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace NServiceBus.ObjectBuilder.Ninject.Internal -{ - using System; - using System.Collections.Generic; - using global::Ninject.Selection.Heuristics; - - /// - /// Implements a heuristic for ninject property injection. - /// - internal interface IObjectBuilderPropertyHeuristic : IInjectionHeuristic - { - /// - /// Gets the registered types. - /// - /// The registered types. - IList RegisteredTypes - { - get; - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Ninject/Internal/NinjectChildContainer.cs b/src/ObjectBuilder.Ninject/Internal/NinjectChildContainer.cs deleted file mode 100644 index fad36480c01..00000000000 --- a/src/ObjectBuilder.Ninject/Internal/NinjectChildContainer.cs +++ /dev/null @@ -1,64 +0,0 @@ -namespace NServiceBus.ObjectBuilder.Ninject.Internal -{ - using System; - using System.Collections.Generic; - using Common; - using global::Ninject; - using global::Ninject.Extensions.NamedScope; - using global::Ninject.Syntax; - - public class NinjectChildContainer : DisposeNotifyingObject, IContainer - { - IResolutionRoot resolutionRoot; - - public NinjectChildContainer(IResolutionRoot resolutionRoot) - { - this.resolutionRoot = resolutionRoot; - } - - public object Build(Type typeToBuild) - { - return resolutionRoot.Get(typeToBuild); - } - - public IEnumerable BuildAll(Type typeToBuild) - { - return resolutionRoot.GetAll(typeToBuild); - } - - public IContainer BuildChildContainer() - { - throw new NotImplementedException(); - } - - public void Configure(Type component, DependencyLifecycle dependencyLifecycle) - { - throw new NotImplementedException(); - } - - public void Configure(Func component, DependencyLifecycle dependencyLifecycle) - { - throw new NotImplementedException(); - } - - public void ConfigureProperty(Type component, string property, object value) - { - throw new NotImplementedException(); - } - - public void RegisterSingleton(Type lookupType, object instance) - { - throw new NotImplementedException(); - } - - public bool HasComponent(Type componentType) - { - throw new NotImplementedException(); - } - - public void Release(object instance) - { - throw new NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Ninject/Internal/NinjectWhenExtensions.cs b/src/ObjectBuilder.Ninject/Internal/NinjectWhenExtensions.cs deleted file mode 100644 index bc55e4d5262..00000000000 --- a/src/ObjectBuilder.Ninject/Internal/NinjectWhenExtensions.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace NServiceBus.ObjectBuilder.Ninject.Internal -{ - using System; - using global::Ninject.Activation; - using global::Ninject.Syntax; - - internal static class NinjectWhenExtensions - { - public static IBindingInNamedWithOrOnSyntax WhenNoAncestorNamed(this IBindingWhenSyntax syntax, string name) - { - return syntax.When(r => !IsAnyAncestorNamed(r, name)); - } - - private static bool IsAnyAncestorNamed(IRequest request, string name) - { - var parentContext = request.ParentContext; - if (parentContext == null) - { - return false; - } - - return - string.Equals(parentContext.Binding.Metadata.Name, name, StringComparison.Ordinal) || - IsAnyAncestorNamed(parentContext.Request, name); - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Ninject/Internal/ObjectBuilderPropertyHeuristic.cs b/src/ObjectBuilder.Ninject/Internal/ObjectBuilderPropertyHeuristic.cs deleted file mode 100644 index 70f763dca21..00000000000 --- a/src/ObjectBuilder.Ninject/Internal/ObjectBuilderPropertyHeuristic.cs +++ /dev/null @@ -1,73 +0,0 @@ - -namespace NServiceBus.ObjectBuilder.Ninject.Internal -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using global::Ninject; - - /// - /// Implements an more aggressive injection heuristic. - /// - class ObjectBuilderPropertyHeuristic : IObjectBuilderPropertyHeuristic - { - IList registeredTypes; - - /// - /// Initializes a new instance of the class. - /// - public ObjectBuilderPropertyHeuristic() - { - registeredTypes = new List(); - } - - /// - /// Gets the registered types. - /// - /// The registered types. - public IList RegisteredTypes - { - get { return registeredTypes; } - private set { registeredTypes = value; } - } - - /// - /// Gets or sets the settings. - /// - /// The settings. - public INinjectSettings Settings{get;set;} - - /// - /// Determines whether a given type should be injected. - /// - /// The member info to check. - /// if a given type needs to be injected; otherwise . - public bool ShouldInject(MemberInfo member) - { - var propertyInfo = member as PropertyInfo; - - if (propertyInfo == null || propertyInfo.GetSetMethod(Settings.InjectNonPublic) == null) - { - return false; - } - - return registeredTypes.Any(x => propertyInfo.DeclaringType.IsAssignableFrom(x)) - && RegisteredTypes.Any(x => propertyInfo.PropertyType.IsAssignableFrom(x)) - && propertyInfo.CanWrite; - } - - public void Dispose() - { - //Injected at compile time - } - - void DisposeManaged() - { - if (registeredTypes != null) - { - registeredTypes.Clear(); - } - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Ninject/NinjectObjectBuilder.cs b/src/ObjectBuilder.Ninject/NinjectObjectBuilder.cs deleted file mode 100644 index 25ee829285a..00000000000 --- a/src/ObjectBuilder.Ninject/NinjectObjectBuilder.cs +++ /dev/null @@ -1,425 +0,0 @@ -namespace NServiceBus.ObjectBuilder.Ninject -{ - using System; - using System.Collections.Generic; - using System.Linq; - using Common; - using global::Ninject; - using global::Ninject.Activation; - using global::Ninject.Infrastructure; - using global::Ninject.Injection; - using global::Ninject.Parameters; - using global::Ninject.Planning.Bindings; - using global::Ninject.Selection; - using Internal; - - /// - /// Implementation of IBuilderInternal using the Ninject Framework container - /// - public class NinjectObjectBuilder : IContainer - { - /// - /// The kernel hold by this object builder. - /// - IKernel kernel; - - /// - /// The object builders injection propertyHeuristic for properties. - /// - IObjectBuilderPropertyHeuristic propertyHeuristic; - - /// - /// Maps the supported to the of ninject. - /// - IDictionary> dependencyLifecycleToScopeMapping = - new Dictionary> - { - { DependencyLifecycle.SingleInstance, StandardScopeCallbacks.Singleton }, - { DependencyLifecycle.InstancePerCall, StandardScopeCallbacks.Transient }, - { DependencyLifecycle.InstancePerUnitOfWork, StandardScopeCallbacks.Transient }, - }; - - /// - /// Initializes a new instance of the class. - /// - public NinjectObjectBuilder() - : this(new StandardKernel()) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - /// Uses the default object builder property - /// . - /// - /// - /// The kernel. - /// - public NinjectObjectBuilder(IKernel kernel) - { - this.kernel = kernel; - - RegisterNecessaryBindings(); - - propertyHeuristic = this.kernel.Get(); - - AddCustomPropertyInjectionHeuristic(); - - this.kernel - .Bind() - .ToSelf() - .DefinesNinjectObjectBuilderScope(); - } - - /// - /// Builds the specified type. - /// - /// - /// The type to build. - /// - /// - /// An instance of the given type. - /// - public object Build(Type typeToBuild) - { - if (!HasComponent(typeToBuild)) - { - throw new ArgumentException(typeToBuild + " is not registered in the container"); - } - - return kernel.Get(typeToBuild); - } - - /// - /// Returns a child instance of the container to facilitate deterministic disposal - /// of all resources built by the child container. - /// - /// A new child container. - public IContainer BuildChildContainer() - { - return kernel.Get(); - } - - /// - /// Returns a list of objects instantiated because their type is compatible with the given type. - /// - /// - /// The type to build. - /// - /// - /// A list of objects - /// - public IEnumerable BuildAll(Type typeToBuild) - { - return kernel.GetAll(typeToBuild); - } - - /// - /// Configures the call model of the given component type. - /// - /// Type to be configured - /// The desired lifecycle for this type - public void Configure(Type component, DependencyLifecycle dependencyLifecycle) - { - if (HasComponent(component)) - { - return; - } - - var instanceScope = GetInstanceScopeFrom(dependencyLifecycle); - - var isInstancePerUnitOfWork = dependencyLifecycle == DependencyLifecycle.InstancePerUnitOfWork; - var bindingConfigurations = BindComponentToItself(component, instanceScope, isInstancePerUnitOfWork); - AddAliasesOfComponentToBindingConfigurations(component, bindingConfigurations); - - propertyHeuristic.RegisteredTypes.Add(component); - } - - /// - /// Configures the call model of the given component type. - /// - /// Type to be configured - /// Factory method that return the type - /// The desired lifecycle for this type - public void Configure(Func componentFactory, DependencyLifecycle dependencyLifecycle) - { - var componentType = typeof (T); - - if (HasComponent(componentType)) - { - return; - } - - var instanceScope = GetInstanceScopeFrom(dependencyLifecycle); - - var isInstancePerUnitOfWork = dependencyLifecycle == DependencyLifecycle.InstancePerUnitOfWork; - var bindingConfigurations = BindComponentToMethod(componentFactory, instanceScope, isInstancePerUnitOfWork); - AddAliasesOfComponentToBindingConfigurations(componentType, bindingConfigurations); - - propertyHeuristic.RegisteredTypes.Add(componentType); - } - - /// - /// Configures the property. - /// - /// - /// The component. - /// - /// - /// The property. - /// - /// - /// The value. - /// - public void ConfigureProperty(Type component, string property, object value) - { - var bindings = kernel.GetBindings(component); - - if (!bindings.Any()) - { - throw new ArgumentException("Component not registered", "component"); - } - - foreach (var binding in bindings) - { - binding.Parameters.Add(new PropertyValue(property, value)); - } - } - - /// - /// Registers the singleton. - /// - /// - /// Type lookup type. - /// - /// - /// The instance. - /// - public void RegisterSingleton(Type lookupType, object instance) - { - if (propertyHeuristic.RegisteredTypes.Contains(lookupType)) - { - kernel - .Rebind(lookupType) - .ToConstant(instance); - return; - } - - propertyHeuristic - .RegisteredTypes - .Add(lookupType); - - kernel - .Bind(lookupType) - .ToConstant(instance); - } - - /// - /// Determines whether the specified component type has a component. - /// - /// - /// Type of the component. - /// - /// - /// true if the specified component type has a component; otherwise, false. - /// - public bool HasComponent(Type componentType) - { - var request = kernel.CreateRequest(componentType, null, new IParameter[0], false, true); - - return kernel.CanResolve(request); - } - - public void Release(object instance) - { - kernel.Release(instance); - } - - /// - /// Gets all service types of a given component. - /// - /// The component. - /// All service types. - static IEnumerable GetAllServiceTypesFor(Type component) - { - if (component == null) - { - return new List(); - } - - var result = new List(component.GetInterfaces()) { component }; - - foreach (var interfaceType in component.GetInterfaces()) - { - result.AddRange(GetAllServiceTypesFor(interfaceType)); - } - - return result.Distinct(); - } - - public void Dispose() - { - //Injected at compile time - } - - void DisposeManaged() - { - if (kernel != null) - { - if (!kernel.IsDisposed) - { - kernel.Dispose(); - } - } - } - - - /// - /// Gets the instance scope from call model. - /// - /// - /// The call model. - /// - /// - /// The instance scope - /// - Func GetInstanceScopeFrom(DependencyLifecycle dependencyLifecycle) - { - Func scope; - - if (!dependencyLifecycleToScopeMapping.TryGetValue(dependencyLifecycle, out scope)) - { - throw new ArgumentException("The dependency lifecycle is not supported", "dependencyLifecycle"); - } - - return scope; - } - - /// - /// Adds the aliases of component to the binding configurations. - /// - /// The component. - /// The binding configurations. - void AddAliasesOfComponentToBindingConfigurations(Type component, IEnumerable bindingConfigurations) - { - var services = GetAllServiceTypesFor(component).Where(t => t != component); - - foreach (var service in services) - { - foreach (var bindingConfiguration in bindingConfigurations) - { - kernel.AddBinding(new Binding(service, bindingConfiguration)); - } - } - } - - /// - /// Binds the component to itself with the given . - /// - /// The component. - /// The instance scope. - /// if set to true an additional binding scoped to the child container is added. - /// The created binding configurations. - IEnumerable BindComponentToItself(Type component, Func instanceScope, bool addChildContainerScope) - { - var bindingConfigurations = new List(); - if (addChildContainerScope) - { - var instanceScopeConfiguration = kernel - .Bind(component) - .ToSelf() - .WhenNotInUnitOfWork() - .InScope(instanceScope) - .BindingConfiguration; - bindingConfigurations.Add(instanceScopeConfiguration); - - var unitOfWorkConfiguration = kernel - .Bind(component) - .ToSelf() - .WhenInUnitOfWork() - .InUnitOfWorkScope() - .BindingConfiguration; - bindingConfigurations.Add(unitOfWorkConfiguration); - } - else - { - var instanceScopeConfiguration = kernel - .Bind(component) - .ToSelf() - .InScope(instanceScope) - .BindingConfiguration; - bindingConfigurations.Add(instanceScopeConfiguration); - } - - return bindingConfigurations; - } - - IEnumerable BindComponentToMethod(Func component, Func instanceScope, bool addChildContainerScope) - { - var bindingConfigurations = new List(); - if (addChildContainerScope) - { - var instanceScopeConfiguration = kernel - .Bind() - .ToMethod(context => component.Invoke()) - .WhenNotInUnitOfWork() - .InScope(instanceScope) - .BindingConfiguration; - bindingConfigurations.Add(instanceScopeConfiguration); - - var unitOfWorkConfiguration = kernel - .Bind() - .ToMethod(context => component.Invoke()) - .WhenInUnitOfWork() - .InUnitOfWorkScope() - .BindingConfiguration; - bindingConfigurations.Add(unitOfWorkConfiguration); - } - else - { - var instanceScopeConfiguration = kernel - .Bind() - .ToMethod(context => component.Invoke()) - .InScope(instanceScope) - .BindingConfiguration; - bindingConfigurations.Add(instanceScopeConfiguration); - } - - return bindingConfigurations; - } - - /// - /// Adds the custom property injection heuristic. - /// - void AddCustomPropertyInjectionHeuristic() - { - var selector = kernel.Components.Get(); - - selector.InjectionHeuristics.Add( - kernel.Get()); - } - - /// - /// Registers the necessary bindings. - /// - void RegisterNecessaryBindings() - { - kernel - .Bind() - .ToConstant(this) - .InSingletonScope(); - - kernel - .Bind() - .To() - .InSingletonScope() - .WithPropertyValue("Settings", context => context.Kernel.Settings); - - kernel - .Bind() - .ToMethod(context => context.Kernel.Components.Get()); - } - } -} diff --git a/src/ObjectBuilder.Ninject/NinjectObjectBuilderExtensions.cs b/src/ObjectBuilder.Ninject/NinjectObjectBuilderExtensions.cs deleted file mode 100644 index 1f9d7d7461e..00000000000 --- a/src/ObjectBuilder.Ninject/NinjectObjectBuilderExtensions.cs +++ /dev/null @@ -1,49 +0,0 @@ -namespace NServiceBus.ObjectBuilder.Ninject -{ - using global::Ninject.Extensions.NamedScope; - using global::Ninject.Syntax; - using Internal; - - public static class NinjectObjectBuilderExtensions - { - const string ScopeName = "NinjectObjectBuilder"; - - /// - /// Defines a conditional binding which is applied when the requested service is in an unit of work. - /// - /// The requested service type. - /// The syntax - /// The binding - public static IBindingInNamedWithOrOnSyntax WhenInUnitOfWork(this IBindingWhenSyntax syntax) - { - return syntax.WhenAnyAnchestorNamed(ScopeName); - } - - /// - /// Defines a conditional binding which is applied when the requested service is NOT in an unit of work. - /// - /// The requested service type. - /// The syntax - /// The binding - public static IBindingInNamedWithOrOnSyntax WhenNotInUnitOfWork(this IBindingWhenSyntax syntax) - { - return syntax.WhenNoAncestorNamed(ScopeName); - } - - /// - /// Defines the unit of work scope on the requested service. - /// - /// The requested service type. - /// The syntax. - /// The binding. - public static IBindingNamedWithOrOnSyntax InUnitOfWorkScope(this IBindingInSyntax syntax) - { - return syntax.InNamedScope(ScopeName); - } - - internal static void DefinesNinjectObjectBuilderScope(this IBindingWhenInNamedWithOrOnSyntax syntax) - { - syntax.Named(ScopeName).DefinesNamedScope(ScopeName); - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Ninject/ObjectBuilder.Ninject.csproj b/src/ObjectBuilder.Ninject/ObjectBuilder.Ninject.csproj deleted file mode 100644 index 35175623042..00000000000 --- a/src/ObjectBuilder.Ninject/ObjectBuilder.Ninject.csproj +++ /dev/null @@ -1,108 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C35AE1C7-C785-4629-A73D-977E0325D8B0} - Library - Properties - NServiceBus.ObjectBuilder.Ninject - NServiceBus.ObjectBuilder.Ninject - v4.0 - 512 - true - ..\NServiceBus.snk - ..\ - - - - - true - full - false - ..\..\binaries\containers\ninject\ - DEBUG;TRACE - prompt - 4 - ..\..\binaries\containers\ninject\NServiceBus.ObjectBuilder.Ninject.xml - 1591,1573 - true - - - pdbonly - true - ..\..\binaries\containers\ninject\ - TRACE - prompt - 4 - ..\..\binaries\containers\ninject\NServiceBus.ObjectBuilder.Ninject.xml - 1591,1573 - true - - - - False - ..\packages\Janitor.Fody.1.1.0.0\Lib\portable-net4+sl5+wp8+win8+wpa81+MonoAndroid16+MonoTouch40\Janitor.dll - False - - - False - ..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll - - - False - ..\packages\Ninject.Extensions.ContextPreservation.3.0.0.8\lib\net40\Ninject.Extensions.ContextPreservation.dll - - - False - ..\packages\Ninject.Extensions.NamedScope.3.0.0.5\lib\net40\Ninject.Extensions.NamedScope.dll - - - - - - - - - - - - - - - - - - - - - {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus - False - - - {DD48B2D0-E996-412D-9157-821ED8B17A9D} - NServiceBus.Core - False - - - - - Designer - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Ninject/Properties/AssemblyInfo.cs b/src/ObjectBuilder.Ninject/Properties/AssemblyInfo.cs deleted file mode 100644 index 5a21aa18fc5..00000000000 --- a/src/ObjectBuilder.Ninject/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("NServiceBus Object Builder Ninject Implementation")] -[assembly: AssemblyDescription("Implementation of object building functionality on top of the Ninject Framework.")] -[assembly: AssemblyCopyright("Copyright 2010-2014 NServiceBus. All rights reserved")] -[assembly: AssemblyProduct("NServiceBus")] -[assembly: AssemblyCompany("NServiceBus Ltd.")] -[assembly: ComVisible(false)] -[assembly: CLSCompliant(true)] diff --git a/src/ObjectBuilder.Ninject/packages.config b/src/ObjectBuilder.Ninject/packages.config deleted file mode 100644 index 715deb72560..00000000000 --- a/src/ObjectBuilder.Ninject/packages.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Spring/ArbitraryFuncDelegatingFactoryObject.cs b/src/ObjectBuilder.Spring/ArbitraryFuncDelegatingFactoryObject.cs deleted file mode 100644 index cb72a36016b..00000000000 --- a/src/ObjectBuilder.Spring/ArbitraryFuncDelegatingFactoryObject.cs +++ /dev/null @@ -1,45 +0,0 @@ -namespace NServiceBus.ObjectBuilder.Spring -{ - using System; - using global::Spring.Objects.Factory; - - class ArbitraryFuncDelegatingFactoryObject : IFactoryObject - { - Func builderDelegate; - - - public ArbitraryFuncDelegatingFactoryObject(Func builderDelegate, bool isSingleton) - { - this.builderDelegate = builderDelegate; - IsSingleton = isSingleton; - } - - - /// - /// Return an instance (possibly shared or independent) of the object managed by this factory. - /// - /// - /// If this method is being called in the context of an enclosing IoC container and returns , the IoC container will consider this factory object as not being fully initialized and throw a corresponding (and most probably fatal) exception. - /// - /// - /// An instance (possibly shared or independent) of the object managed by this factory. - /// - public object GetObject() - { - return builderDelegate.Invoke(); - } - - /// - /// Return the of object that this creates, or if not known in advance. - /// - public Type ObjectType - { - get { return typeof(T); } - } - - /// - /// Is the object managed by this factory a singleton or a prototype? - /// - public bool IsSingleton { get; private set; } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Spring/ComponentConfig.cs b/src/ObjectBuilder.Spring/ComponentConfig.cs deleted file mode 100644 index b2e202851f0..00000000000 --- a/src/ObjectBuilder.Spring/ComponentConfig.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace NServiceBus.ObjectBuilder.Spring -{ - using System.Collections.Generic; - using global::Spring.Objects.Factory.Support; - - class ComponentConfig : IComponentConfig - { - Dictionary properties = new Dictionary(); - - public void Configure(ObjectDefinitionBuilder builder) - { - foreach (var keyValue in properties) - { - builder.AddPropertyValue(keyValue.Key, keyValue.Value); - } - } - - public IComponentConfig ConfigureProperty(string name, object value) - { - properties[name] = value; - - return this; - } - } -} diff --git a/src/ObjectBuilder.Spring/ConfigureSpringBuilder.cs b/src/ObjectBuilder.Spring/ConfigureSpringBuilder.cs deleted file mode 100644 index 0e9176c4238..00000000000 --- a/src/ObjectBuilder.Spring/ConfigureSpringBuilder.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace NServiceBus -{ - using System; - using ObjectBuilder.Common.Config; - using ObjectBuilder.Spring; - using Spring.Context.Support; - - /// - /// Contains extension methods to for configuring the Spring container. - /// - public static class ConfigureSpringBuilder - { - /// - /// Use the Spring Framework as the container. - /// - public static Configure SpringFrameworkBuilder(this Configure config) - { - ConfigureCommon.With(config, new SpringObjectBuilder()); - - return config; - } - - /// - /// Use the Spring Framework as the container with the initialized application context - /// - [CLSCompliant(false)] - public static Configure SpringFrameworkBuilder(this Configure config,GenericApplicationContext applicationContext) - { - ConfigureCommon.With(config, new SpringObjectBuilder(applicationContext)); - - return config; - } - - } -} diff --git a/src/ObjectBuilder.Spring/FodyWeavers.xml b/src/ObjectBuilder.Spring/FodyWeavers.xml deleted file mode 100644 index 7172ab76b3b..00000000000 --- a/src/ObjectBuilder.Spring/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Spring/ObjectBuilder.Spring.csproj b/src/ObjectBuilder.Spring/ObjectBuilder.Spring.csproj deleted file mode 100644 index 02112fdd7e5..00000000000 --- a/src/ObjectBuilder.Spring/ObjectBuilder.Spring.csproj +++ /dev/null @@ -1,101 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {734D30CF-4376-488A-A6B4-1033FED93660} - Library - Properties - NServiceBus.ObjectBuilder.Spring - NServiceBus.ObjectBuilder.Spring - v4.0 - 512 - true - ..\NServiceBus.snk - ..\ - - - - - true - full - false - ..\..\binaries\containers\spring\ - DEBUG;TRACE - prompt - 4 - ..\..\binaries\containers\spring\NServiceBus.ObjectBuilder.Spring.xml - 1591,1573 - true - - - pdbonly - true - ..\..\binaries\containers\spring\ - TRACE - prompt - 4 - ..\..\binaries\containers\spring\NServiceBus.ObjectBuilder.Spring.xml - 1591,1573 - true - - - - False - ..\packages\Common.Logging.1.2.0\lib\1.0\Common.Logging.dll - - - False - ..\packages\Janitor.Fody.1.1.0.0\Lib\portable-net4+sl5+wp8+win8+wpa81+MonoAndroid16+MonoTouch40\Janitor.dll - False - - - False - ..\packages\Spring.Core.1.3.2\lib\net40\Spring.Core.dll - - - - - - - - - - - - - - - - - - {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus - False - - - {DD48B2D0-E996-412D-9157-821ED8B17A9D} - NServiceBus.Core - False - - - - - Designer - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Spring/Properties/AssemblyInfo.cs b/src/ObjectBuilder.Spring/Properties/AssemblyInfo.cs deleted file mode 100644 index 85a30b7ec49..00000000000 --- a/src/ObjectBuilder.Spring/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("NServiceBus Object Builder Spring Implementation")] -[assembly: AssemblyDescription("Implementation of object building functionality on top of the Spring Framework.")] -[assembly: AssemblyCopyright("Copyright 2010-2014 NServiceBus. All rights reserved")] -[assembly: AssemblyProduct("NServiceBus")] -[assembly: AssemblyCompany("NServiceBus Ltd.")] -[assembly: ComVisible(false)] -[assembly: CLSCompliant(true)] - diff --git a/src/ObjectBuilder.Spring/SpringObjectBuilder.cs b/src/ObjectBuilder.Spring/SpringObjectBuilder.cs deleted file mode 100644 index 610b44448e9..00000000000 --- a/src/ObjectBuilder.Spring/SpringObjectBuilder.cs +++ /dev/null @@ -1,219 +0,0 @@ -namespace NServiceBus.ObjectBuilder.Spring -{ - using System; - using System.Collections.Generic; - using Common; - using global::Spring.Context.Support; - using global::Spring.Objects.Factory.Config; - using global::Spring.Objects.Factory.Support; - - /// - /// Implementation of using the Spring Framework container - /// - public class SpringObjectBuilder : IContainer - { - GenericApplicationContext context; - bool isChildContainer; - Dictionary typeHandleLookup = new Dictionary(); - Dictionary componentProperties = new Dictionary(); - bool initialized; - DefaultObjectDefinitionFactory factory = new DefaultObjectDefinitionFactory(); - - /// - /// Instantiates the builder using a new . - /// - public SpringObjectBuilder() : this(new GenericApplicationContext()) - { - } - - /// - /// Instantiates the builder using the given container. - /// - [CLSCompliant(false)] - public SpringObjectBuilder(GenericApplicationContext context) - { - this.context = context; - } - - public void Dispose() - { - //Injected at compile time - } - - void DisposeManaged() - { - //This is to figure out if Dispose was called from a child container or not - if (isChildContainer) - { - return; - } - - if (context != null) - { - context.Dispose(); - } - } - - public IContainer BuildChildContainer() - { - Init(); - return new SpringObjectBuilder(context) - { - isChildContainer = true, - initialized = true, - typeHandleLookup = typeHandleLookup, - componentProperties = componentProperties, - factory = factory - }; - } - - public object Build(Type typeToBuild) - { - Init(); - var dict = context.GetObjectsOfType(typeToBuild, true, false); - - var de = dict.GetEnumerator(); - - if (de.MoveNext()) - { - return de.Value; - } - - throw new ArgumentException(string.Format("{0} has not been configured. In order to avoid this exception, check the return value of the 'HasComponent' method for this type.", typeToBuild)); - } - - public IEnumerable BuildAll(Type typeToBuild) - { - Init(); - var dict = context.GetObjectsOfType(typeToBuild, true, false); - - var de = dict.GetEnumerator(); - while (de.MoveNext()) - { - yield return de.Entry.Value; - } - } - - public void Configure(Type concreteComponent, DependencyLifecycle dependencyLifecycle) - { - if (initialized) - { - throw new InvalidOperationException("You can't alter the registrations after the container components has been resolved from the container"); - } - - typeHandleLookup[concreteComponent] = dependencyLifecycle; - - lock (componentProperties) - { - if (!componentProperties.ContainsKey(concreteComponent)) - { - componentProperties[concreteComponent] = new ComponentConfig(); - } - } - } - - public void Configure(Func componentFactory, DependencyLifecycle dependencyLifecycle) - { - var componentType = typeof(T); - - if (HasComponent(componentType)) - { - return; - } - - var funcFactory = new ArbitraryFuncDelegatingFactoryObject(componentFactory, dependencyLifecycle == DependencyLifecycle.SingleInstance); - - context.ObjectFactory.RegisterSingleton(componentType.FullName, funcFactory); - } - - public void ConfigureProperty(Type concreteComponent, string property, object value) - { - if (initialized) - { - throw new InvalidOperationException("You can't alter the registrations after the container components has been resolved from the container"); - } - - lock (componentProperties) - { - ComponentConfig result; - componentProperties.TryGetValue(concreteComponent, out result); - - if (result == null) - { - throw new InvalidOperationException("Cannot configure property before the component has been configured. Please call 'Configure' first."); - } - - result.ConfigureProperty(property, value); - } - } - - public void RegisterSingleton(Type lookupType, object instance) - { - if (initialized) - { - throw new InvalidOperationException("You can't alter the registrations after the container components has been resolved from the container"); - } - - context.ObjectFactory.RegisterSingleton(lookupType.FullName, instance); - } - - public bool HasComponent(Type componentType) - { - if (componentProperties.ContainsKey(componentType)) - { - return true; - } - - if (context.ObjectFactory.ContainsObjectDefinition(componentType.FullName)) - { - return true; - } - - if (context.ObjectFactory.ContainsSingleton(componentType.FullName)) - { - return true; - } - - foreach (var component in componentProperties.Keys) - { - if (componentType.IsAssignableFrom(component)) - { - return true; - } - } - - return false; - } - - public void Release(object instance) - { - } - - void Init() - { - if (initialized) - { - return; - } - - lock (componentProperties) - { - foreach (var t in componentProperties.Keys) - { - var builder = ObjectDefinitionBuilder.RootObjectDefinition(factory, t) - .SetAutowireMode(AutoWiringMode.AutoDetect) - .SetSingleton(typeHandleLookup[t] == DependencyLifecycle.SingleInstance); - - componentProperties[t].Configure(builder); - - IObjectDefinition def = builder.ObjectDefinition; - context.RegisterObjectDefinition(t.FullName, def); - } - } - - initialized = true; - context.Refresh(); - } - - } -} diff --git a/src/ObjectBuilder.Spring/packages.config b/src/ObjectBuilder.Spring/packages.config deleted file mode 100644 index 55bb25122f8..00000000000 --- a/src/ObjectBuilder.Spring/packages.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.StructureMap/ConfigureStructureMapBuilder.cs b/src/ObjectBuilder.StructureMap/ConfigureStructureMapBuilder.cs deleted file mode 100644 index 22b479ccc1f..00000000000 --- a/src/ObjectBuilder.StructureMap/ConfigureStructureMapBuilder.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace NServiceBus -{ - using ObjectBuilder.Common.Config; - using ObjectBuilder.StructureMap; - using StructureMap; - - /// - /// Contains extension methods to . - /// - public static class ConfigureStructureMapBuilder - { - /// - /// Use StructureMap as your container. - /// - public static Configure StructureMapBuilder(this Configure config) - { - ConfigureCommon.With(config, new StructureMapObjectBuilder()); - - return config; - } - - /// - /// Use StructureMap as your container passing in a pre-configured container to be used by nServiceBus. - /// - public static Configure StructureMapBuilder(this Configure config, IContainer container) - { - ConfigureCommon.With(config, new StructureMapObjectBuilder(container)); - - return config; - } - } -} - diff --git a/src/ObjectBuilder.StructureMap/FodyWeavers.xml b/src/ObjectBuilder.StructureMap/FodyWeavers.xml deleted file mode 100644 index 7172ab76b3b..00000000000 --- a/src/ObjectBuilder.StructureMap/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.StructureMap/ObjectBuilder.StructureMap.csproj b/src/ObjectBuilder.StructureMap/ObjectBuilder.StructureMap.csproj deleted file mode 100644 index 43f9ecf879f..00000000000 --- a/src/ObjectBuilder.StructureMap/ObjectBuilder.StructureMap.csproj +++ /dev/null @@ -1,98 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C05E5B87-EB74-4A3F-B4FC-AFDD28570850} - Library - Properties - NServiceBus.ObjectBuilder.StructureMap - NServiceBus.ObjectBuilder.StructureMap - v4.0 - 512 - true - ..\NServiceBus.snk - ..\ - - - - - true - full - false - ..\..\binaries\containers\structuremap\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - ..\..\binaries\containers\structuremap\NServiceBus.ObjectBuilder.StructureMap.xml - 1591,1573 - true - - - pdbonly - true - ..\..\binaries\containers\structuremap\ - TRACE - prompt - 4 - AllRules.ruleset - ..\..\binaries\containers\structuremap\NServiceBus.ObjectBuilder.StructureMap.xml - 1591,1573 - true - - - - False - ..\packages\Janitor.Fody.1.1.0.0\Lib\portable-net4+sl5+wp8+win8+wpa81+MonoAndroid16+MonoTouch40\Janitor.dll - False - - - False - ..\packages\structuremap.2.6.4.1\lib\net40\StructureMap.dll - - - - - - - - - - - - - - - - - {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus - False - - - {DD48B2D0-E996-412D-9157-821ED8B17A9D} - NServiceBus.Core - False - - - - - Designer - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.StructureMap/Properties/AssemblyInfo.cs b/src/ObjectBuilder.StructureMap/Properties/AssemblyInfo.cs deleted file mode 100644 index eb0e94bb0d8..00000000000 --- a/src/ObjectBuilder.StructureMap/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("NServiceBus Container StructureMap Implementation")] -[assembly: AssemblyDescription("Implementation of container functionality on top of StructureMap.")] -[assembly: AssemblyCopyright("Copyright 2010-2014 NServiceBus. All rights reserved")] -[assembly: AssemblyProduct("NServiceBus")] -[assembly: AssemblyCompany("NServiceBus Ltd.")] -[assembly: ComVisible(false)] -[assembly: CLSCompliant(true)] diff --git a/src/ObjectBuilder.StructureMap/StructureMapExtensions.cs b/src/ObjectBuilder.StructureMap/StructureMapExtensions.cs deleted file mode 100644 index 3abdd17e090..00000000000 --- a/src/ObjectBuilder.StructureMap/StructureMapExtensions.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace NServiceBus.ObjectBuilder.StructureMap -{ - using System; - using global::StructureMap; - using global::StructureMap.Graph; - using global::StructureMap.Pipeline; - - /// - /// Extensions to the StructureMap api - /// - public static class StructureMapExtensions - { - /// - /// Registers the given interface and redirects to the given pluginType when the interface is requested - /// - public static void RegisterAdditionalInterfaceForPluginType(this ConfigurationExpression configuration, Type implementedInterface, Type pluginType, ILifecycle lifecycle) - { - var type = typeof(Registration<,>).MakeGenericType(implementedInterface, pluginType); - - var registration = (IRegistration)Activator.CreateInstance(type); - - registration.RegisterServiceInterface(configuration,lifecycle); - } - - /// - /// Tells StructureMap to do setter injection for the given type - /// - public static void EnableSetterInjectionFor(this ConfigurationExpression configuration, Type pluginType) - { - PluginCache.AddFilledType(pluginType); - } - - // The inner type and interface is just a little trick to - // grease the generic wheels - interface IRegistration - { - void RegisterServiceInterface(ConfigurationExpression config, ILifecycle callModel); - } - - class Registration : IRegistration where TImplementor : TInterface - { - public void RegisterServiceInterface(ConfigurationExpression config, ILifecycle lifecycle) - { - config.For() - .LifecycleIs(lifecycle) - .Use(context => context.GetInstance()); - } - } - - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.StructureMap/StructureMapObjectBuilder.cs b/src/ObjectBuilder.StructureMap/StructureMapObjectBuilder.cs deleted file mode 100644 index ad382166b82..00000000000 --- a/src/ObjectBuilder.StructureMap/StructureMapObjectBuilder.cs +++ /dev/null @@ -1,201 +0,0 @@ -namespace NServiceBus.ObjectBuilder.StructureMap -{ - using System; - using System.Collections.Generic; - using System.Linq; - using global::StructureMap; - using global::StructureMap.Graph; - using global::StructureMap.Pipeline; - using global::StructureMap.TypeRules; - - /// - /// ObjectBuilder implementation for the StructureMap IoC-Container - /// - public class StructureMapObjectBuilder : Common.IContainer - { - IContainer container; - IDictionary configuredInstances = new Dictionary(); - - public StructureMapObjectBuilder() - { - container = ObjectFactory.GetInstance(); - } - - public StructureMapObjectBuilder(IContainer container) - { - this.container = container; - } - - public void Dispose() - { - //Injected at compile time - } - - /// - /// Returns a child instance of the container to facilitate deterministic disposal - /// of all resources built by the child container. - /// - public Common.IContainer BuildChildContainer() - { - return new StructureMapObjectBuilder(container.GetNestedContainer()); - } - - public object Build(Type typeToBuild) - { - if (container.Model.PluginTypes.Any(t => t.PluginType == typeToBuild)) - { - return container.GetInstance(typeToBuild); - } - - throw new ArgumentException(typeToBuild + " is not registered in the container"); - } - - public IEnumerable BuildAll(Type typeToBuild) - { - return container.GetAllInstances(typeToBuild).Cast(); - } - - public void ConfigureProperty(Type component, string property, object value) - { - if (value == null) - { - return; - } - - lock (configuredInstances) - { - Instance instance; - configuredInstances.TryGetValue(component, out instance); - - var configuredInstance = instance as ConfiguredInstance; - - if (configuredInstance == null) - { - throw new InvalidOperationException("Cannot configure property before the component has been configured. Please call 'Configure' first."); - } - - if (value.GetType().IsSimple()) - { - configuredInstance.WithProperty(property).EqualTo(value); - } - else - { - configuredInstance.Child(property).Is(value); - } - } - } - - public void Configure(Type component, DependencyLifecycle dependencyLifecycle) - { - lock (configuredInstances) - { - if (configuredInstances.ContainsKey(component)) - { - return; - } - } - - var lifecycle = GetLifecycleFrom(dependencyLifecycle); - - ConfiguredInstance configuredInstance = null; - - container.Configure(x => - { - configuredInstance = x.For(component) - .LifecycleIs(lifecycle) - .Use(component); - - x.EnableSetterInjectionFor(component); - - foreach (var implementedInterface in GetAllInterfacesImplementedBy(component)) - { - x.RegisterAdditionalInterfaceForPluginType(implementedInterface, component,lifecycle); - - x.EnableSetterInjectionFor(implementedInterface); - } - }); - - lock (configuredInstances) - { - configuredInstances.Add(component, configuredInstance); - } - } - - public void Configure(Func componentFactory, DependencyLifecycle dependencyLifecycle) - { - var pluginType = typeof(T); - - lock (configuredInstances) - { - if (configuredInstances.ContainsKey(pluginType)) - { - return; - } - } - - var lifecycle = GetLifecycleFrom(dependencyLifecycle); - LambdaInstance lambdaInstance = null; - - container.Configure(x => - { - lambdaInstance = x.For() - .LifecycleIs(lifecycle) - .Use(componentFactory); - - x.EnableSetterInjectionFor(pluginType); - - foreach (var implementedInterface in GetAllInterfacesImplementedBy(pluginType)) - { - x.RegisterAdditionalInterfaceForPluginType(implementedInterface, pluginType, lifecycle); - x.EnableSetterInjectionFor(implementedInterface); - } - } - ); - - lock (configuredInstances) - { - configuredInstances.Add(pluginType, lambdaInstance); - } - } - - public void RegisterSingleton(Type lookupType, object instance) - { - container.Configure(x => x.For(lookupType) - .Singleton() - .Use(instance)); - PluginCache.AddFilledType(lookupType); - } - - public bool HasComponent(Type componentType) - { - return container.Model.PluginTypes.Any(t => t.PluginType == componentType); - } - - public void Release(object instance) - { - - } - - static ILifecycle GetLifecycleFrom(DependencyLifecycle dependencyLifecycle) - { - switch (dependencyLifecycle) - { - case DependencyLifecycle.InstancePerCall: - return new UniquePerRequestLifecycle(); - case DependencyLifecycle.SingleInstance: - return new SingletonLifecycle(); - case DependencyLifecycle.InstancePerUnitOfWork: - return null;//null means the default lifecycle which is transient - } - - throw new ArgumentException("Unhandled lifecycle - " + dependencyLifecycle); - } - - static IEnumerable GetAllInterfacesImplementedBy(Type t) - { -// ReSharper disable once ConditionIsAlwaysTrueOrFalse - return t.GetInterfaces().Where(x=>x.FullName != null && !x.FullName.StartsWith("System.")); - } - - } -} diff --git a/src/ObjectBuilder.StructureMap/packages.config b/src/ObjectBuilder.StructureMap/packages.config deleted file mode 100644 index 6cdb78bacc3..00000000000 --- a/src/ObjectBuilder.StructureMap/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Tests/BuilderFixture.cs b/src/ObjectBuilder.Tests/BuilderFixture.cs deleted file mode 100644 index 017254a6a2d..00000000000 --- a/src/ObjectBuilder.Tests/BuilderFixture.cs +++ /dev/null @@ -1,82 +0,0 @@ -namespace ObjectBuilder.Tests -{ - using System; - using System.Collections.Generic; - using System.Linq; - using Ninject; - using Ninject.Extensions.ContextPreservation; - using Ninject.Extensions.NamedScope; - using NServiceBus.ObjectBuilder.Autofac; - using NServiceBus.ObjectBuilder.CastleWindsor; - using NServiceBus.ObjectBuilder.Ninject; - using NServiceBus.ObjectBuilder.Spring; - using NServiceBus.ObjectBuilder.StructureMap; - using NServiceBus.ObjectBuilder.Unity; - using NUnit.Framework; - using StructureMap; - using IContainer = NServiceBus.ObjectBuilder.Common.IContainer; - - public class BuilderFixture - { - protected virtual Action InitializeBuilder() - { - //no-op - return c => { }; - } - - IList objectBuilders; - - protected void ForAllBuilders(Action assertion, params Type[] containersToIgnore) - { - foreach (var builder in objectBuilders.Where(b => !containersToIgnore.Contains(b.GetType()))) - { - try - { - assertion(builder); - } - catch (Exception) - { - Console.Out.WriteLine("Assertion failed for builder: {0}", builder.GetType().Name); - throw; - } - } - } - - [SetUp] - public void SetUp() - { - objectBuilders = new List - { - //add all supported builders here - new StructureMapObjectBuilder(new Container()), - new AutofacObjectBuilder(), - new WindsorObjectBuilder(), - new UnityObjectBuilder(), - new SpringObjectBuilder(), - new NinjectObjectBuilder(new StandardKernel(new NinjectSettings {LoadExtensions = false}, - new ContextPreservationModule(), new NamedScopeModule())), - }; - - DefaultInstances.Clear(); - - var initialize = InitializeBuilder(); - - foreach (var builder in objectBuilders) - { - initialize(builder); - } - } - - [TearDown] - public void DisposeContainers() - { - if (objectBuilders != null) - { - foreach (var builder in objectBuilders) - { - builder.Dispose(); - } - } - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Tests/ObjectBuilder.Tests.csproj b/src/ObjectBuilder.Tests/ObjectBuilder.Tests.csproj deleted file mode 100644 index c2f11c1b26c..00000000000 --- a/src/ObjectBuilder.Tests/ObjectBuilder.Tests.csproj +++ /dev/null @@ -1,124 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {0A282BF4-0957-4074-8D5E-C2FB8634A3AA} - Library - Properties - ObjectBuilder.Tests - ObjectBuilder.Tests - v4.0 - 512 - false - ..\NServiceBus.snk - ..\ - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - true - - - pdbonly - true - bin\Release\ - DEBUG;TRACE - prompt - 4 - true - - - - ..\packages\Autofac.3.1.5\lib\net40\Autofac.dll - - - False - ..\packages\Castle.Core.3.2.1\lib\net40-client\Castle.Core.dll - - - ..\packages\Castle.Windsor.3.2.1\lib\net40\Castle.Windsor.dll - - - ..\packages\Common.Logging.1.2.0\lib\1.0\Common.Logging.dll - - - ..\packages\log4net.1.2.10\lib\2.0\log4net.dll - - - ..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll - - - ..\packages\Ninject.Extensions.ContextPreservation.3.0.0.8\lib\net40\Ninject.Extensions.ContextPreservation.dll - - - ..\packages\Ninject.Extensions.NamedScope.3.0.0.5\lib\net40\Ninject.Extensions.NamedScope.dll - - - False - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll - - - ..\packages\Spring.Core.1.3.2\lib\net40\Spring.Core.dll - - - ..\packages\structuremap.2.6.4.1\lib\net40\StructureMap.dll - - - - - - - - - - - - - - - - - - - - - - - {DD48B2D0-E996-412D-9157-821ED8B17A9D} - NServiceBus.Core - - - {73ec4ebe-826d-4a0a-8837-51d3458fc2a8} - ObjectBuilder.Autofac - - - {9a9a0bd5-ac37-4b90-b90f-fd1c1395febd} - ObjectBuilder.CastleWindsor - - - {c35ae1c7-c785-4629-a73d-977e0325d8b0} - ObjectBuilder.Ninject - - - {734d30cf-4376-488a-a6b4-1033fed93660} - ObjectBuilder.Spring - - - {c05e5b87-eb74-4a3f-b4fc-afdd28570850} - ObjectBuilder.StructureMap - - - {343b2e7a-e228-4b31-abb5-f5437b2e7a4c} - ObjectBuilder.Unity - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Tests/When_building_components.cs b/src/ObjectBuilder.Tests/When_building_components.cs deleted file mode 100644 index 5f651804f1b..00000000000 --- a/src/ObjectBuilder.Tests/When_building_components.cs +++ /dev/null @@ -1,157 +0,0 @@ -namespace ObjectBuilder.Tests -{ - using System; - using NServiceBus; - using NServiceBus.ObjectBuilder.CastleWindsor; - using NServiceBus.ObjectBuilder.Common; - using NServiceBus.ObjectBuilder.Spring; - using NUnit.Framework; - - [TestFixture] - public class When_building_components : BuilderFixture - { - [Test] - public void Singleton_components_should_yield_the_same_instance() - { - ForAllBuilders(builder => - Assert.AreEqual(builder.Build(typeof(SingletonComponent)), builder.Build(typeof(SingletonComponent)))); - } - - [Test] - public void Singlecall_components_should_yield_unique_instances() - { - ForAllBuilders(builder => - Assert.AreNotEqual(builder.Build(typeof(SinglecallComponent)), builder.Build(typeof(SinglecallComponent)))); - } - - [Test] - public void UoW_components_should_resolve_from_main_container() - { - ForAllBuilders(builder => - Assert.NotNull(builder.Build(typeof(InstancePerUoWComponent))) - , typeof(WindsorObjectBuilder)); - } - - [Test] - public void Lambda_uow_components_should_resolve_from_main_container() - { - ForAllBuilders(builder => - Assert.NotNull(builder.Build(typeof(LambdaComponentUoW))), - typeof(WindsorObjectBuilder)); - } - - [Test] - public void Lambda_singlecall_components_should_yield_unique_instances() - { - ForAllBuilders(builder => - Assert.AreNotEqual(builder.Build(typeof(SingleCallLambdaComponent)), builder.Build(typeof(SingleCallLambdaComponent)))); - } - - [Test] - public void Lambda_singleton_components_should_yield_the_same_instance() - { - ForAllBuilders(builder => - Assert.AreEqual(builder.Build(typeof(SingletonLambdaComponent)), builder.Build(typeof(SingletonLambdaComponent)))); - } - - [Test] - public void Requesting_an_unregistered_component_should_throw() - { - - ForAllBuilders(builder => - Assert.That(() => builder.Build(typeof(UnregisteredComponent)), - Throws.Exception)); - } - - [Test] - public void Should_be_able_to_build_components_registered_after_first_build() - { - ForAllBuilders(builder => - { - builder.Build(typeof (SingletonComponent)); - builder.Configure(typeof (UnregisteredComponent), DependencyLifecycle.SingleInstance); - - var unregisteredComponent = builder.Build(typeof(UnregisteredComponent)) as UnregisteredComponent; - Assert.NotNull(unregisteredComponent); - Assert.NotNull(unregisteredComponent.SingletonComponent); - } - ,typeof(SpringObjectBuilder)); - } - - [Test] - public void Should_support_mixed_dependency_styles() - { - ForAllBuilders(builder => - { - builder.Configure(typeof(ComponentWithBothConstructorAndSetterInjection), DependencyLifecycle.InstancePerCall); - builder.Configure(typeof(ConstructorDependency), DependencyLifecycle.InstancePerCall); - builder.Configure(typeof(SetterDependency), DependencyLifecycle.InstancePerCall); - - var component = (ComponentWithBothConstructorAndSetterInjection)builder.Build(typeof(ComponentWithBothConstructorAndSetterInjection)); - - Assert.NotNull(component.ConstructorDependency); - Assert.NotNull(component.SetterDependency); - }, typeof(SpringObjectBuilder)); - } - - - protected override Action InitializeBuilder() - { - return config => - { - config.Configure(typeof(SingletonComponent), DependencyLifecycle.SingleInstance); - config.Configure(typeof(SinglecallComponent), DependencyLifecycle.InstancePerCall); - config.Configure(typeof(InstancePerUoWComponent), DependencyLifecycle.InstancePerUnitOfWork); - config.Configure(() => new SingletonLambdaComponent(), DependencyLifecycle.SingleInstance); - config.Configure(() => new SingleCallLambdaComponent(), DependencyLifecycle.InstancePerCall); - config.Configure(() => new LambdaComponentUoW(), DependencyLifecycle.InstancePerUnitOfWork); - }; - } - - public class SingletonComponent - { - } - public class SinglecallComponent - { - } - public class UnregisteredComponent - { - public SingletonComponent SingletonComponent { get; set; } - } - public class SingletonLambdaComponent { } - public class LambdaComponentUoW { } - public class SingleCallLambdaComponent { } - } - - public class StaticFactory - { - public ComponentCreatedByFactory Create() - { - return new ComponentCreatedByFactory(); - } - } - - public class ComponentCreatedByFactory - { - } - - public class ComponentWithBothConstructorAndSetterInjection - { - public ComponentWithBothConstructorAndSetterInjection(ConstructorDependency constructorDependency) - { - ConstructorDependency = constructorDependency; - } - - public ConstructorDependency ConstructorDependency { get; private set; } - - public SetterDependency SetterDependency { get; set; } - } - - public class ConstructorDependency - { - } - - public class SetterDependency - { - } -} diff --git a/src/ObjectBuilder.Tests/When_disposing_the_builder.cs b/src/ObjectBuilder.Tests/When_disposing_the_builder.cs deleted file mode 100644 index 4665c0c6b62..00000000000 --- a/src/ObjectBuilder.Tests/When_disposing_the_builder.cs +++ /dev/null @@ -1,112 +0,0 @@ -namespace ObjectBuilder.Tests -{ - using System; - using System.Diagnostics; - using System.Threading.Tasks; - using NServiceBus; - using NServiceBus.ObjectBuilder.Common; - using NServiceBus.ObjectBuilder.Spring; - using NUnit.Framework; - - [TestFixture] - public class When_disposing_the_builder : BuilderFixture - { - [Test] - public void Should_dispose_all_IDisposable_components() - { - ForAllBuilders(builder => - { - DisposableComponent.DisposeCalled = false; - AnotherSingletonComponent.DisposeCalled = false; - - builder.Configure(typeof(DisposableComponent), DependencyLifecycle.SingleInstance); - builder.RegisterSingleton(typeof(AnotherSingletonComponent), new AnotherSingletonComponent()); - - builder.Build(typeof(DisposableComponent)); - builder.Build(typeof(AnotherSingletonComponent)); - builder.Dispose(); - - Assert.True(DisposableComponent.DisposeCalled, "Dispose should be called on DisposableComponent"); - Assert.True(AnotherSingletonComponent.DisposeCalled, "Dispose should be called on AnotherSingletonComponent"); - }); - } - [Test] - public void When_circular_ref_exists_between_container_and_builder_should_not_infinite_loop() - { - ForAllBuilders(builder => - { - Debug.WriteLine("Trying " + builder.GetType().Name); - builder.RegisterSingleton(builder.GetType(), builder); - builder.Dispose(); - }); - } - - [Test] - public void Should_dispose_all_IDisposable_components_in_child_container() - { - ForAllBuilders(main => - { - DisposableComponent.DisposeCalled = false; - AnotherSingletonComponent.DisposeCalled = false; - - main.RegisterSingleton(typeof(AnotherSingletonComponent), new AnotherSingletonComponent()); - main.Configure(typeof(DisposableComponent), DependencyLifecycle.InstancePerUnitOfWork); - - using (var builder = main.BuildChildContainer()) - { - builder.Build(typeof(DisposableComponent)); - } - - Assert.False(AnotherSingletonComponent.DisposeCalled, "Dispose should not be called on AnotherSingletonComponent because it belongs to main container"); - Assert.True(DisposableComponent.DisposeCalled, "Dispose should be called on DisposableComponent"); - }, typeof(SpringObjectBuilder)); - } - - [Test, Ignore] - public void Spring_only_Should_dispose_all_IDisposable_components_only_when_then_main_container_is_disposed() - { - using (var container = (IContainer) new SpringObjectBuilder()) - { - DisposableComponent.DisposeCalled = false; - AnotherSingletonComponent.DisposeCalled = false; - - container.RegisterSingleton(typeof(AnotherSingletonComponent), new AnotherSingletonComponent()); - container.Configure(typeof(DisposableComponent), DependencyLifecycle.InstancePerUnitOfWork); - - Task.Factory.StartNew( - () => - { - using (var builder = container.BuildChildContainer()) - { - builder.Build(typeof (DisposableComponent)); - } - }, TaskCreationOptions.LongRunning).Wait(); - - Assert.False(DisposableComponent.DisposeCalled, "Dispose should not be called on DisposableComponent because Spring does not support child containers!"); - } - - Assert.True(DisposableComponent.DisposeCalled, "Dispose should be called on DisposableComponent"); - Assert.True(AnotherSingletonComponent.DisposeCalled, "Dispose should be called on AnotherSingletonComponent"); - } - - public class DisposableComponent : IDisposable - { - public static bool DisposeCalled; - - public void Dispose() - { - DisposeCalled = true; - } - } - - public class AnotherSingletonComponent : IDisposable - { - public static bool DisposeCalled; - - public void Dispose() - { - DisposeCalled = true; - } - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Tests/When_querying_for_registered_components.cs b/src/ObjectBuilder.Tests/When_querying_for_registered_components.cs deleted file mode 100644 index 481acd2f4dd..00000000000 --- a/src/ObjectBuilder.Tests/When_querying_for_registered_components.cs +++ /dev/null @@ -1,58 +0,0 @@ -namespace ObjectBuilder.Tests -{ - using System; - using NServiceBus; - using NServiceBus.ObjectBuilder.Common; - using NUnit.Framework; - - [TestFixture] - public class When_querying_for_registered_components : BuilderFixture - { - [Test] - public void Existing_components_should_return_true() - { - ForAllBuilders(builder => - Assert.True(builder.HasComponent(typeof(ExistingComponent)))); - } - - [Test] - public void Non_existing_components_should_return_false() - { - ForAllBuilders(builder => - Assert.False(builder.HasComponent(typeof(NonExistingComponent)))); - } - - [Test] - public void Builders_should_not_determine_existence_by_building_components() - { - ForAllBuilders(builder => - Assert.True(builder.HasComponent(typeof(ExistingComponentWithUnsatisfiedDependency)))); - } - - protected override Action InitializeBuilder() - { - return c => - { - c.Configure(typeof(ExistingComponent), DependencyLifecycle.InstancePerCall); - c.Configure(typeof(ExistingComponentWithUnsatisfiedDependency), DependencyLifecycle.InstancePerCall); - }; - } - - public class NonExistingComponent - { - } - - public class ExistingComponent - { - } - - public class ExistingComponentWithUnsatisfiedDependency - { - // ReSharper disable once UnusedParameter.Local - public ExistingComponentWithUnsatisfiedDependency(NonExistingComponent dependency) - { - - } - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Tests/When_registering_components.cs b/src/ObjectBuilder.Tests/When_registering_components.cs deleted file mode 100644 index eb2080292bc..00000000000 --- a/src/ObjectBuilder.Tests/When_registering_components.cs +++ /dev/null @@ -1,356 +0,0 @@ -namespace ObjectBuilder.Tests -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using NServiceBus; - using NServiceBus.ObjectBuilder.CastleWindsor; - using NServiceBus.ObjectBuilder.Spring; - using NUnit.Framework; - - [TestFixture] - public class When_registering_components : BuilderFixture - { - [Test] - public void Multiple_registrations_of_the_same_component_should_be_allowed() - { - - ForAllBuilders(builder => - { - builder.Configure(typeof(DuplicateClass), DependencyLifecycle.InstancePerCall); - builder.Configure(typeof(DuplicateClass), DependencyLifecycle.InstancePerCall); - - Assert.AreEqual(1, builder.BuildAll(typeof(DuplicateClass)).Count()); - }); - } - - [Test] - public void Should_support_lambdas_that_uses_other_components_registered_later() - { - ForAllBuilders(builder => - { - builder.Configure(() => ((StaticFactory)builder.Build(typeof(StaticFactory))).Create(), DependencyLifecycle.InstancePerCall); - builder.Configure(() => new StaticFactory(), DependencyLifecycle.SingleInstance); - - Assert.NotNull(builder.Build(typeof(ComponentCreatedByFactory))); - }); - } - - [Test] - public void A_registration_should_be_allowed_to_be_updated() - { - - ForAllBuilders(builder => - { - builder.RegisterSingleton(typeof(ISingletonComponent), new SingletonComponent()); - builder.RegisterSingleton(typeof(ISingletonComponent), new AnotherSingletonComponent()); - - Assert.IsInstanceOf(builder.Build(typeof(ISingletonComponent))); - }, typeof(SpringObjectBuilder)); - } - - [Test] - public void Register_singleton_should_be_supported() - { - ForAllBuilders(builder => - { - var singleton = new SingletonComponent(); - builder.RegisterSingleton(typeof(ISingletonComponent), singleton); - builder.RegisterSingleton(typeof(SingletonComponent), singleton); - Assert.AreEqual(builder.Build(typeof(SingletonComponent)), singleton); - Assert.AreEqual(builder.Build(typeof(ISingletonComponent)), singleton); - }); - } - - [Test] - public void Registering_the_same_singleton_for_different_interfaces_should_be_supported() - { - ForAllBuilders(builder => - { - var singleton = new SingletonThatImplementsToInterfaces(); - builder.RegisterSingleton(typeof(ISingleton1), singleton); - builder.RegisterSingleton(typeof(ISingleton2), singleton); - - builder.Configure(typeof(ComponentThatDependsOnMultiSingletons), DependencyLifecycle.InstancePerCall); - - var dependency = (ComponentThatDependsOnMultiSingletons)builder.Build(typeof (ComponentThatDependsOnMultiSingletons)); - - Assert.NotNull(dependency.Singleton1); - Assert.NotNull(dependency.Singleton2); - - Assert.AreEqual(builder.Build(typeof(ISingleton1)), singleton); - Assert.AreEqual(builder.Build(typeof(ISingleton2)), singleton); - },typeof(SpringObjectBuilder)); - } - - [Test] - public void Properties_set_on_duplicate_registrations_should_not_be_discarded() - { - ForAllBuilders(builder => - { - builder.Configure(typeof(DuplicateClass), DependencyLifecycle.SingleInstance); - builder.ConfigureProperty(typeof(DuplicateClass), "SomeProperty", true); - - builder.Configure(typeof(DuplicateClass), DependencyLifecycle.SingleInstance); - builder.ConfigureProperty(typeof(DuplicateClass), "AnotherProperty", true); - - var component = (DuplicateClass)builder.Build(typeof(DuplicateClass)); - - Assert.True(component.SomeProperty); - - Assert.True(component.AnotherProperty); - }); - } - - - [Test] - public void Setter_dependencies_should_be_supported() - { - ForAllBuilders(builder => - { - builder.Configure(typeof(SomeClass), DependencyLifecycle.InstancePerCall); - builder.Configure(typeof(ClassWithSetterDependencies), DependencyLifecycle.SingleInstance); - builder.ConfigureProperty(typeof(ClassWithSetterDependencies), "EnumDependency", SomeEnum.X); - builder.ConfigureProperty(typeof(ClassWithSetterDependencies), "SimpleDependency", 1); - builder.ConfigureProperty(typeof(ClassWithSetterDependencies), "StringDependency", "Test"); - - var component = (ClassWithSetterDependencies)builder.Build(typeof(ClassWithSetterDependencies)); - - Assert.AreEqual(component.EnumDependency, SomeEnum.X); - Assert.AreEqual(component.SimpleDependency, 1); - Assert.AreEqual(component.StringDependency, "Test"); - Assert.NotNull(component.ConcreteDependency, "Concrete classed should be property injected"); - Assert.NotNull(component.InterfaceDependency, "Interfaces should be property injected"); - Assert.NotNull(component.concreteDependencyWithSetOnly, "Set only properties should be supported"); - }); - } - - [Test] - public void Setter_dependencies_should_override_container_defaults() - { - ForAllBuilders(builder => - { - builder.Configure(typeof(SomeClass), DependencyLifecycle.InstancePerCall); - builder.Configure(typeof(ClassWithSetterDependencies), DependencyLifecycle.SingleInstance); - builder.ConfigureProperty(typeof(ClassWithSetterDependencies), "InterfaceDependency", new SomeOtherClass()); - - var component = (ClassWithSetterDependencies)builder.Build(typeof(ClassWithSetterDependencies)); - - Assert.IsInstanceOf(typeof(SomeOtherClass), component.InterfaceDependency, "Explicitly set dependency should be injected, not container's default type"); - }); - } - - [Test] - public void Concrete_classes_should_get_the_same_lifecycle_as_their_interfaces() - { - ForAllBuilders(builder => - { - builder.Configure(typeof(SingletonComponent), DependencyLifecycle.SingleInstance); - - Assert.AreSame(builder.Build(typeof(SingletonComponent)), builder.Build(typeof(ISingletonComponent))); - }); - } - - [Test] - public void All_implemented_interfaces_should_be_registered() - { - ForAllBuilders(builder => - { - builder.Configure(typeof (ComponentWithMultipleInterfaces), - DependencyLifecycle.InstancePerCall); - - Assert.True(builder.HasComponent(typeof (ISomeInterface))); - - Assert.True(builder.HasComponent(typeof (ISomeOtherInterface))); - - Assert.True(builder.HasComponent(typeof (IYetAnotherInterface))); - - Assert.AreEqual(1, builder.BuildAll(typeof (IYetAnotherInterface)).Count()); - } - ); - } - - [Test] - public void All_implemented_interfaces_should_be_registered_for_func() - { - ForAllBuilders(builder => - { - builder.Configure(() => new ComponentWithMultipleInterfaces(), DependencyLifecycle.InstancePerCall); - - Assert.True(builder.HasComponent(typeof(ISomeInterface))); - Assert.True(builder.HasComponent(typeof(ISomeOtherInterface))); - Assert.True(builder.HasComponent(typeof(IYetAnotherInterface))); - Assert.AreEqual(1, builder.BuildAll(typeof(IYetAnotherInterface)).Count()); - }, - typeof(SpringObjectBuilder)); - } - - [Test] - public void Multiple_implementations_should_be_supported() - { - ForAllBuilders(builder => - { - builder.Configure(typeof(SomeClass), DependencyLifecycle.InstancePerUnitOfWork); - builder.Configure(typeof(SomeOtherClass), DependencyLifecycle.InstancePerUnitOfWork); - - Assert.NotNull(builder.Build(typeof(SomeClass))); - Assert.AreEqual(2, builder.BuildAll(typeof(ISomeInterface)).Count()); - - using (var childBuilder = builder.BuildChildContainer()) - { - Assert.NotNull(childBuilder.Build(typeof(SomeClass))); - Assert.AreEqual(2, childBuilder.BuildAll(typeof(ISomeInterface)).Count()); - } - } - ,typeof(WindsorObjectBuilder)); - } - - [Test] - public void Given_lookupType_should_be_used_as_service_in_the_registration_when_RegisterSingleton() - { - ForAllBuilders(builder => - { - var expected = new InheritedFromSomeClass(); - builder.RegisterSingleton(typeof (SomeClass), expected); - - Assert.NotNull(builder.Build(typeof (SomeClass))); - Assert.AreEqual(expected, builder.Build(typeof (SomeClass))); - - using (var childBuilder = builder.BuildChildContainer()) - { - Assert.NotNull(childBuilder.Build(typeof (SomeClass))); - Assert.AreEqual(expected, childBuilder.Build(typeof (SomeClass))); - } - }); - } - - [Test] - public void Generic_interfaces_should_be_registered() - { - ForAllBuilders(builder => - { - builder.Configure(typeof (ComponentWithGenericInterface), - DependencyLifecycle.InstancePerCall); - - Assert.True(builder.HasComponent(typeof (ISomeGenericInterface))); - } - ); - } - - [Test, Ignore("Not sure that we should enforce this")] - public void System_interfaces_should_not_be_auto_registered() - { - ForAllBuilders(builder => - { - builder.Configure(typeof (ComponentWithSystemInterface), - DependencyLifecycle.InstancePerCall); - - Assert.False(builder.HasComponent(typeof (IGrouping))); - Assert.False(builder.HasComponent(typeof (IDisposable))); - } - ); - } - } - - public class ComponentThatDependsOnMultiSingletons - { - public ISingleton1 Singleton1 { get; set; } - public ISingleton2 Singleton2 { get; set; } - } - - public class SingletonThatImplementsToInterfaces : ISingleton2 - { - } - - public interface ISingleton2 : ISingleton1 - { - } - - public interface ISingleton1 - { - } - - public class ComponentWithMultipleInterfaces : ISomeInterface, ISomeOtherInterface - { - } - - public class ComponentWithGenericInterface : ISomeGenericInterface - { - } - - public class ComponentWithSystemInterface : IGrouping, IDisposable - { - public IEnumerator GetEnumerator() - { - throw new NotImplementedException(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public string Key - { - get { throw new NotImplementedException(); } - } - - public void Dispose() - { - throw new NotImplementedException(); - } - } - - public interface ISomeGenericInterface - { - } - - public interface ISomeOtherInterface : IYetAnotherInterface - { - } - - public interface IYetAnotherInterface - { - } - - public class DuplicateClass - { - public bool SomeProperty { get; set; } - public bool AnotherProperty { get; set; } - } - - public class ClassWithSetterDependencies - { - public SomeEnum EnumDependency { get; set; } - public int SimpleDependency { get; set; } - public string StringDependency { get; set; } - public ISomeInterface InterfaceDependency { get; set; } - public SomeClass ConcreteDependency { get; set; } - public SomeClass ConcreteDependencyWithSetOnly { set { concreteDependencyWithSetOnly = value; } } - public SomeClass ConcreteDependencyWithPrivateSet { get; private set; } - - public SomeClass concreteDependencyWithSetOnly; - } - - public class SomeClass : ISomeInterface - { - } - - public class InheritedFromSomeClass : SomeClass - { - } - - public class SomeOtherClass : ISomeInterface - { - } - - public interface ISomeInterface - { - } - - public enum SomeEnum - { - X - } -} diff --git a/src/ObjectBuilder.Tests/When_releasing_components.cs b/src/ObjectBuilder.Tests/When_releasing_components.cs deleted file mode 100644 index efc952e4485..00000000000 --- a/src/ObjectBuilder.Tests/When_releasing_components.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace ObjectBuilder.Tests -{ - using System; - using NServiceBus; - using NServiceBus.ObjectBuilder.Autofac; - using NUnit.Framework; - - [TestFixture] - public class When_releasing_components : BuilderFixture - { - [Test] - public void Transient_component_should_be_destructed_called() - { - ForAllBuilders(builder => - { - builder.Configure(typeof (TransientClass), DependencyLifecycle.InstancePerCall); - - var comp = (TransientClass) builder.Build(typeof (TransientClass)); - comp.Name = "Jon"; - - var weak = new WeakReference(comp); - - builder.Release(comp); - - // ReSharper disable once RedundantAssignment - comp = null; - - GC.Collect(); - GC.WaitForPendingFinalizers(); - - Assert.IsFalse(weak.IsAlive); - Assert.IsTrue(TransientClass.Destructed); - }, typeof(AutofacObjectBuilder)); - } - - public class TransientClass - { - public static bool Destructed; - - public string Name { get; set; } - - ~TransientClass() - { - Destructed = true; - } - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Tests/When_using_nested_containers.cs b/src/ObjectBuilder.Tests/When_using_nested_containers.cs deleted file mode 100644 index 6fbc08442ae..00000000000 --- a/src/ObjectBuilder.Tests/When_using_nested_containers.cs +++ /dev/null @@ -1,247 +0,0 @@ -namespace ObjectBuilder.Tests -{ - using System; - using System.Diagnostics; - using System.Threading.Tasks; - using NServiceBus; - using NServiceBus.ObjectBuilder.Autofac; - using NServiceBus.ObjectBuilder.CastleWindsor; - using NServiceBus.ObjectBuilder.Ninject; - using NServiceBus.ObjectBuilder.Spring; - using NServiceBus.ObjectBuilder.Unity; - using NUnit.Framework; - using IContainer = NServiceBus.ObjectBuilder.Common.IContainer; - - [TestFixture] - public class When_using_nested_containers : BuilderFixture - { - - [Test] - public void Instance_per_uow__components_should_be_disposed_when_the_child_container_is_disposed() - { - ForAllBuilders(builder => - { - builder.Configure(typeof(InstancePerUoWComponent), DependencyLifecycle.InstancePerUnitOfWork); - - using (var nestedContainer = builder.BuildChildContainer()) - nestedContainer.Build(typeof(InstancePerUoWComponent)); - - Assert.True(InstancePerUoWComponent.DisposeCalled); - }, - typeof(SpringObjectBuilder)); - } - - [Test] - public void Instance_per_uow__components_should_not_be_shared_across_child_containers() - { - ForAllBuilders(builder => - { - builder.Configure(typeof(InstancePerUoWComponent), - DependencyLifecycle.InstancePerUnitOfWork); - - var task1 = - Task.Factory.StartNew( - () => - { - using (var childContainer = builder.BuildChildContainer()) - { - return childContainer.Build(typeof(InstancePerUoWComponent)); - } - }); - var task2 = - Task.Factory.StartNew( - () => - { - using (var childContainer = builder.BuildChildContainer()) - { - return childContainer.Build(typeof(InstancePerUoWComponent)); - } - }); - - Assert.AreNotSame(task1.Result, task2.Result); - - }, typeof(SpringObjectBuilder)); - } - - [Test] - public void Instance_per_call_components_should_not_be_shared_across_child_containers() - { - ForAllBuilders(builder => - { - builder.Configure(typeof(InstancePerCallComponent), DependencyLifecycle.InstancePerCall); - - object instance1, instance2; - using (var nestedContainer = builder.BuildChildContainer()) - { - instance1 = nestedContainer.Build(typeof(InstancePerCallComponent)); - } - - using (var anotherNestedContainer = builder.BuildChildContainer()) - { - instance2 = anotherNestedContainer.Build(typeof(InstancePerCallComponent)); - } - - Assert.AreNotSame(instance1, instance2); - }); - } - - [Test, Explicit("Time consuming")] - public void Instance_per_call_components_should_not_cause_memory_leaks() - { - //const int iterations = 1000000; - const int iterations = 20000; - - ForAllBuilders(builder => - { - builder.Configure(typeof(InstancePerCallComponent), DependencyLifecycle.InstancePerUnitOfWork); - - GC.Collect(); - var before = GC.GetTotalMemory(true); - var sw = Stopwatch.StartNew(); - - for (var i = 0; i < iterations; i++) - { - using (var nestedContainer = builder.BuildChildContainer()) - { - nestedContainer.Build(typeof(InstancePerCallComponent)); - } - } - - sw.Stop(); - // Collect all generations of memory. - GC.Collect(); - - var after = GC.GetTotalMemory(true); - Console.WriteLine("{0} Time: {1} MemDelta: {2} bytes", builder.GetType().Name, sw.Elapsed, after - before); - - var upperLimitBytes = 200 * 1024; - Assert.That(after-before, Is.LessThan(upperLimitBytes), "Apparently {0} consumed more than {1} KB of memory", builder, upperLimitBytes/1024); - }, typeof(NinjectObjectBuilder)); - } - - [TestCase(10000, Ignore=true)] - [TestCase(20000, Ignore=true)] - [Description("Left in for convenience - MHG will remove soon")] - public void It_works_with_specific_object_builder(int iterations) - { - IContainer builder = new NinjectObjectBuilder(); - - builder.Configure(typeof(InstancePerCallComponent), DependencyLifecycle.SingleInstance); - - GC.Collect(); - var before = GC.GetTotalMemory(true); - var sw = Stopwatch.StartNew(); - - for (var i = 0; i < iterations; i++) - { - using (var nestedContainer = builder.BuildChildContainer()) - { - nestedContainer.Build(typeof(InstancePerCallComponent)); - } - } - - sw.Stop(); - // Collect all generations of memory. - GC.Collect(); - - var after = GC.GetTotalMemory(true); - Console.WriteLine("{0} reps: {1} Time: {2} MemDelta: {3} bytes", iterations, builder.GetType().Name, sw.Elapsed, after - before); - } - - [Test] - public void UoW_components_in_the_parent_container_should_be_singletons_in_the_child_container() - { - ForAllBuilders(builder => - { - builder.Configure(typeof(InstancePerUoWComponent), DependencyLifecycle.InstancePerUnitOfWork); - - using (var nestedContainer = builder.BuildChildContainer()) - { - Assert.AreSame(nestedContainer.Build(typeof(InstancePerUoWComponent)), nestedContainer.Build(typeof(InstancePerUoWComponent)),"UoW's should be singleton in child container"); - } - }, - typeof(SpringObjectBuilder)); - } - - [Test] - public void UoW_components_should_by_instance_per_call_in_root_container() - { - ForAllBuilders(builder => - { - builder.Configure(typeof(InstancePerUoWComponent), DependencyLifecycle.InstancePerUnitOfWork); - - using (builder.BuildChildContainer()) - { - //no-op - } - - Assert.AreNotSame(builder.Build(typeof(InstancePerUoWComponent)), builder.Build(typeof(InstancePerUoWComponent)), "UoW's should be instance per call in the root container"); - }, - typeof(AutofacObjectBuilder), typeof(WindsorObjectBuilder), typeof(UnityObjectBuilder)); - } - [Test] - public void Should_not_dispose_singletons_when_container_goes_out_of_scope() - { - ForAllBuilders(builder => - { - var singletonInMainContainer = new SingletonComponent(); - - builder.RegisterSingleton(typeof(ISingletonComponent), singletonInMainContainer); - builder.Configure(typeof(ComponentThatDependsOfSingleton), DependencyLifecycle.InstancePerUnitOfWork); - - using (var nestedContainer = builder.BuildChildContainer()) - { - nestedContainer.Build(typeof(ComponentThatDependsOfSingleton)); - } - - Assert.False(SingletonComponent.DisposeCalled); - }, - typeof(SpringObjectBuilder)); - } - - class SingletonComponent : ISingletonComponent, IDisposable - { - public static bool DisposeCalled; - - public void Dispose() - { - DisposeCalled = true; - } - } - - class ComponentThatDependsOfSingleton - { - - } - } - - public class InstancePerCallComponent : IDisposable - { - public void Dispose() - { - } - } - - public class InstancePerUoWComponent : IDisposable - { - public static bool DisposeCalled; - - public void Dispose() - { - DisposeCalled = true; - } - - } - - public class SingletonComponent : ISingletonComponent - { - } - - public class AnotherSingletonComponent : ISingletonComponent - { - } - - public interface ISingletonComponent - { - } -} diff --git a/src/ObjectBuilder.Tests/packages.config b/src/ObjectBuilder.Tests/packages.config deleted file mode 100644 index cbc2f401ad2..00000000000 --- a/src/ObjectBuilder.Tests/packages.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Unity/ConfigureUnityBuilder.cs b/src/ObjectBuilder.Unity/ConfigureUnityBuilder.cs deleted file mode 100644 index 5bdd4d5eb8a..00000000000 --- a/src/ObjectBuilder.Unity/ConfigureUnityBuilder.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace NServiceBus -{ - using Microsoft.Practices.Unity; - using ObjectBuilder.Common.Config; - using ObjectBuilder.Unity; - - /// - /// Contains extension methods for configuring object builder infrastructure through Unity container. - /// - public static class ConfigureUnityBuilder - { - /// - /// Use the Unity builder. - /// - public static Configure UnityBuilder(this Configure config) - { - ConfigureCommon.With(config, new UnityObjectBuilder()); - return config; - } - - /// - /// Use the Unity builder passing in a pre-configured container to be used by nServiceBus. - /// - public static Configure UnityBuilder(this Configure config, IUnityContainer container) - { - ConfigureCommon.With(config, new UnityObjectBuilder(container)); - return config; - } - } -} diff --git a/src/ObjectBuilder.Unity/DefaultInstances.cs b/src/ObjectBuilder.Unity/DefaultInstances.cs deleted file mode 100644 index a6a8713abc8..00000000000 --- a/src/ObjectBuilder.Unity/DefaultInstances.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace NServiceBus.ObjectBuilder.Unity -{ - using System; - using System.Collections.Generic; - - public static class DefaultInstances - { - static readonly HashSet typesWithDefaultInstances = new HashSet(); - - public static bool Contains(Type type) - { - return typesWithDefaultInstances.Contains(type); - } - - public static void Add(Type type) - { - typesWithDefaultInstances.Add(type); - } - - public static void Clear() - { - typesWithDefaultInstances.Clear(); - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Unity/FodyWeavers.xml b/src/ObjectBuilder.Unity/FodyWeavers.xml deleted file mode 100644 index 7172ab76b3b..00000000000 --- a/src/ObjectBuilder.Unity/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Unity/ObjectBuilder.Unity.csproj b/src/ObjectBuilder.Unity/ObjectBuilder.Unity.csproj deleted file mode 100644 index ad921d46217..00000000000 --- a/src/ObjectBuilder.Unity/ObjectBuilder.Unity.csproj +++ /dev/null @@ -1,116 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {343B2E7A-E228-4B31-ABB5-F5437B2E7A4C} - Library - Properties - NServiceBus.ObjectBuilder.Unity - NServiceBus.ObjectBuilder.Unity - v4.0 - 512 - true - ..\NServiceBus.snk - ..\ - - - - - true - full - false - ..\..\binaries\containers\unity\ - DEBUG;TRACE - prompt - 4 - ..\..\binaries\containers\unity\NServiceBus.ObjectBuilder.Unity.xml - 1591,1573 - true - - - pdbonly - true - ..\..\binaries\containers\unity\ - TRACE - prompt - 4 - ..\..\binaries\containers\unity\NServiceBus.ObjectBuilder.Unity.xml - 1591,1573 - true - - - - False - ..\packages\Janitor.Fody.1.1.0.0\Lib\portable-net4+sl5+wp8+win8+wpa81+MonoAndroid16+MonoTouch40\Janitor.dll - False - - - False - ..\packages\CommonServiceLocator.1.0\lib\NET35\Microsoft.Practices.ServiceLocation.dll - - - False - ..\packages\Unity.2.1.505.2\lib\NET35\Microsoft.Practices.Unity.dll - - - False - ..\packages\Unity.2.1.505.2\lib\NET35\Microsoft.Practices.Unity.Configuration.dll - - - False - ..\packages\Unity.Interception.2.1.505.2\lib\NET35\Microsoft.Practices.Unity.Interception.dll - - - False - ..\packages\Unity.Interception.2.1.505.2\lib\NET35\Microsoft.Practices.Unity.Interception.Configuration.dll - - - - - - - - - - - - - - - - - - - - - - - Designer - - - - - {dd48b2d0-e996-412d-9157-821ed8b17a9d} - NServiceBus.Core - - - {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Unity/Properties/AssemblyInfo.cs b/src/ObjectBuilder.Unity/Properties/AssemblyInfo.cs deleted file mode 100644 index 5f953d35b63..00000000000 --- a/src/ObjectBuilder.Unity/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("NServiceBus Container Unity Implementation")] -[assembly: AssemblyDescription("Implementation of container functionality on top of Unity.")] -[assembly: AssemblyCopyright("Copyright 2010-2014 NServiceBus. All rights reserved")] -[assembly: AssemblyProduct("NServiceBus")] -[assembly: AssemblyCompany("NServiceBus Ltd.")] -[assembly: ComVisible(false)] -[assembly: CLSCompliant(true)] diff --git a/src/ObjectBuilder.Unity/PropertyInjectionBuilderStrategy.cs b/src/ObjectBuilder.Unity/PropertyInjectionBuilderStrategy.cs deleted file mode 100644 index 52ff3370a59..00000000000 --- a/src/ObjectBuilder.Unity/PropertyInjectionBuilderStrategy.cs +++ /dev/null @@ -1,62 +0,0 @@ -namespace NServiceBus.ObjectBuilder.Unity -{ - using System; - using System.Collections.Generic; - using System.Linq; - using Microsoft.Practices.ObjectBuilder2; - using Microsoft.Practices.Unity; - - public class PropertyInjectionBuilderStrategy : BuilderStrategy - { - IUnityContainer unityContainer; - static IDictionary>> configuredProperties = new Dictionary>>(); - - public PropertyInjectionBuilderStrategy(IUnityContainer unityContainer) - { - this.unityContainer = unityContainer; - } - - public static void SetPropertyValue(Type type, string name,object value) - { - List> properties; - if (!configuredProperties.TryGetValue(type, out properties)) - { - configuredProperties[type] = properties = new List>(); - } - - properties.Add(new Tuple(name, value)); - } - - public override void PreBuildUp(IBuilderContext context) - { - var type = context.BuildKey.Type; - if (!type.FullName.StartsWith("Microsoft.Practices")) - { - var properties = type.GetProperties(); - foreach (var property in properties) - { - if (!property.CanWrite) - { - continue; - } - - if (unityContainer.IsRegistered(property.PropertyType)) - { - property.SetValue(context.Existing, unityContainer.Resolve(property.PropertyType),null); - } - - List> configuredProperty; - if(configuredProperties.TryGetValue(type, out configuredProperty)) - { - var p = configuredProperty.FirstOrDefault(t => t.Item1 == property.Name); - - if (p != null) - { - property.SetValue(context.Existing, p.Item2,null); - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Unity/PropertyInjectionContainerExtension.cs b/src/ObjectBuilder.Unity/PropertyInjectionContainerExtension.cs deleted file mode 100644 index 710dfdcc2f8..00000000000 --- a/src/ObjectBuilder.Unity/PropertyInjectionContainerExtension.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace NServiceBus.ObjectBuilder.Unity -{ - using Microsoft.Practices.Unity; - using Microsoft.Practices.Unity.ObjectBuilder; - - public class PropertyInjectionContainerExtension : UnityContainerExtension - { - protected override void Initialize() - { - Context.Strategies.Add(new PropertyInjectionBuilderStrategy(Container), UnityBuildStage.Initialization); - } - } -} \ No newline at end of file diff --git a/src/ObjectBuilder.Unity/UnityObjectBuilder.cs b/src/ObjectBuilder.Unity/UnityObjectBuilder.cs deleted file mode 100644 index 2cebc5f7215..00000000000 --- a/src/ObjectBuilder.Unity/UnityObjectBuilder.cs +++ /dev/null @@ -1,171 +0,0 @@ -namespace NServiceBus.ObjectBuilder.Unity -{ - using System; - using System.Collections.Generic; - using System.Linq; - using Common; - using Microsoft.Practices.Unity; - - public class UnityObjectBuilder : IContainer - { - IUnityContainer container; - - /// - /// Instantiates the class with a new . - /// - public UnityObjectBuilder() - : this(new UnityContainer()) - { - } - - /// - /// Instantiates the class saving the given container. - /// - public UnityObjectBuilder(IUnityContainer container) - { - this.container = container; - - var propertyInjectionExtension = this.container.Configure(); - if (propertyInjectionExtension == null) - { - this.container.AddNewExtension(); - } - - } - - public void Dispose() - { - //Injected at compile time - } - - /// - /// Returns a child instance of the container to facilitate deterministic disposal - /// of all resources built by the child container. - /// - public IContainer BuildChildContainer() - { - return new UnityObjectBuilder(container.CreateChildContainer()); - } - - public object Build(Type typeToBuild) - { - if (!DefaultInstances.Contains(typeToBuild)) - { - throw new ArgumentException(typeToBuild + " is not registered in the container"); - } - - return container.Resolve(typeToBuild); - } - - public IEnumerable BuildAll(Type typeToBuild) - { - if (DefaultInstances.Contains(typeToBuild)) - { - yield return container.Resolve(typeToBuild); - foreach (var component in container.ResolveAll(typeToBuild)) - { - yield return component; - } - } - } - - public void Configure(Type concreteComponent, DependencyLifecycle dependencyLifecycle) - { - if (HasComponent(concreteComponent)) - { - return; - } - - var interfaces = GetAllServiceTypesFor(concreteComponent); - - foreach (var t in interfaces) - { - if (DefaultInstances.Contains(t)) - { - container.RegisterType(t, concreteComponent, Guid.NewGuid().ToString(), GetLifetimeManager(dependencyLifecycle)); - } - else - { - container.RegisterType(t, concreteComponent, GetLifetimeManager(dependencyLifecycle)); - DefaultInstances.Add(t); - } - } - } - - public void Configure(Func componentFactory, DependencyLifecycle dependencyLifecycle) - { - var componentType = typeof (T); - - if (HasComponent(componentType)) - { - return; - } - - var interfaces = GetAllServiceTypesFor(componentType); - - foreach (var t in interfaces) - { - if (DefaultInstances.Contains(t)) - { - container.RegisterType(t, Guid.NewGuid().ToString(), GetLifetimeManager(dependencyLifecycle), - new InjectionFactory(unityContainer => componentFactory())); - } - else - { - container.RegisterType(t, GetLifetimeManager(dependencyLifecycle), new InjectionFactory(unityContainer => componentFactory())); - DefaultInstances.Add(t); - } - } - } - - public void ConfigureProperty(Type concreteComponent, string property, object value) - { - PropertyInjectionBuilderStrategy.SetPropertyValue(concreteComponent, property, value); - } - - public void RegisterSingleton(Type lookupType, object instance) - { - DefaultInstances.Add(lookupType); - container.RegisterInstance(lookupType, instance); - } - - public bool HasComponent(Type componentType) - { - return container.IsRegistered(componentType); - } - - public void Release(object instance) - { - //Not sure if I need to call this or not! - container.Teardown(instance); - } - - static IEnumerable GetAllServiceTypesFor(Type t) - { - if (t == null) - { - return new List(); - } - -// ReSharper disable once ConditionIsAlwaysTrueOrFalse - return new List(t.GetInterfaces().Where(x => x.FullName != null && !x.FullName.StartsWith("System."))) - { - t - }; - } - - private static LifetimeManager GetLifetimeManager(DependencyLifecycle dependencyLifecycle) - { - switch (dependencyLifecycle) - { - case DependencyLifecycle.InstancePerCall: - return new TransientLifetimeManager(); - case DependencyLifecycle.SingleInstance: - return new ContainerControlledLifetimeManager(); - case DependencyLifecycle.InstancePerUnitOfWork: - return new HierarchicalLifetimeManager(); - } - throw new ArgumentException("Unhandled lifecycle - " + dependencyLifecycle); - } - } -} diff --git a/src/ObjectBuilder.Unity/packages.config b/src/ObjectBuilder.Unity/packages.config deleted file mode 100644 index 0d5d2ebb6c6..00000000000 --- a/src/ObjectBuilder.Unity/packages.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file From 35de1a0cfbad6d5b967adefb88dc03012249aaab Mon Sep 17 00:00:00 2001 From: Ramon Smits Date: Wed, 24 Feb 2016 20:32:30 +0100 Subject: [PATCH 2/2] Solution file to VS2015 as projects rely on VS2015 compiler settings. --- src/NServiceBus.sln | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/NServiceBus.sln b/src/NServiceBus.sln index 7e09e88a31d..f1cdd77f6d8 100644 --- a/src/NServiceBus.sln +++ b/src/NServiceBus.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.40629.0 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NServiceBus", "NServiceBus\NServiceBus.csproj", "{73867D40-8CBB-48E9-BFFA-12BBDD48A341}" EndProject