From 2b39cf416921aa40b5f820eadd0c80209c74eb14 Mon Sep 17 00:00:00 2001 From: David Rundle Date: Sun, 13 Oct 2013 23:11:46 +0100 Subject: [PATCH 1/2] updated to work with version 0.3.x (DR and GA) worked with Gary Allen on this. --- src/Calc.CommandLine/Calc.CommandLine.csproj | 21 +++-- src/Calc.CommandLine/Program.cs | 92 +++++++++++++++++-- src/Calc.CommandLine/packages.config | 8 +- src/Calculator.Boxes.sln | 14 +++ src/Calculator.Boxes.sln.DotSettings | 3 + .../Container.Windsor.csproj | 76 +++++++++++++++ .../Properties/AssemblyInfo.cs | 36 ++++++++ src/Container.Windsor/SetupWindsor.cs | 25 +++++ src/Container.Windsor/manifest.xml | 15 +++ src/Container.Windsor/packages.config | 8 ++ src/Identifiers.Windsor/Extension.cs | 49 +++++----- src/Identifiers.Windsor/Filter.cs | 5 +- .../Identifiers.Windsor.csproj | 12 ++- src/Identifiers.Windsor/packages.config | 7 +- src/Process/Application.cs | 43 +++++++++ src/Process/DefaultPackageLoader.cs | 83 +++++++++++++++++ src/Process/ILoadProcess.cs | 10 ++ src/Process/PipelineExecutorWrapper.cs | 49 ++++++++++ src/Process/Process.csproj | 79 ++++++++++++++++ src/Process/Properties/AssemblyInfo.cs | 36 ++++++++ src/Process/manifest.xml | 15 +++ src/Process/packages.config | 8 ++ 22 files changed, 638 insertions(+), 56 deletions(-) create mode 100644 src/Calculator.Boxes.sln.DotSettings create mode 100644 src/Container.Windsor/Container.Windsor.csproj create mode 100644 src/Container.Windsor/Properties/AssemblyInfo.cs create mode 100644 src/Container.Windsor/SetupWindsor.cs create mode 100644 src/Container.Windsor/manifest.xml create mode 100644 src/Container.Windsor/packages.config create mode 100644 src/Process/Application.cs create mode 100644 src/Process/DefaultPackageLoader.cs create mode 100644 src/Process/ILoadProcess.cs create mode 100644 src/Process/PipelineExecutorWrapper.cs create mode 100644 src/Process/Process.csproj create mode 100644 src/Process/Properties/AssemblyInfo.cs create mode 100644 src/Process/manifest.xml create mode 100644 src/Process/packages.config diff --git a/src/Calc.CommandLine/Calc.CommandLine.csproj b/src/Calc.CommandLine/Calc.CommandLine.csproj index cb6196a..c085cfe 100644 --- a/src/Calc.CommandLine/Calc.CommandLine.csproj +++ b/src/Calc.CommandLine/Calc.CommandLine.csproj @@ -34,23 +34,20 @@ 4 - - False - ..\packages\Boxes.Core.0.1.17\lib\net40\Boxes.Core.dll + + ..\packages\Boxes.Core.0.3.27\lib\net40\Boxes.Core.dll - - False - ..\packages\Boxes.Integration.0.1.6\lib\net40\Boxes.Integration.dll + + ..\packages\Boxes.Integration.0.3.16\lib\net40\Boxes.Integration.dll - - False - ..\packages\Boxes.Windsor.0.1.7\lib\net40\Boxes.Windsor.dll + + ..\packages\Boxes.Windsor.0.3.17\lib\net40\Boxes.Windsor.dll ..\packages\Castle.Core.3.2.0\lib\net45\Castle.Core.dll - ..\packages\Castle.Windsor.3.2.0\lib\net45\Castle.Windsor.dll + ..\packages\Castle.Windsor.3.2.1\lib\net45\Castle.Windsor.dll @@ -80,6 +77,10 @@ {5F873342-D9A3-49AD-9398-3391350C124A} Identifiers + + {9147ef1b-645b-4b6f-819d-61ebff66b43d} + Process + + \ No newline at end of file diff --git a/src/Container.Windsor/Properties/AssemblyInfo.cs b/src/Container.Windsor/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3742f90 --- /dev/null +++ b/src/Container.Windsor/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Container.Windsor")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Container.Windsor")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a0235064-2d1f-4819-aca6-754e73149a26")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Container.Windsor/SetupWindsor.cs b/src/Container.Windsor/SetupWindsor.cs new file mode 100644 index 0000000..0b96e8e --- /dev/null +++ b/src/Container.Windsor/SetupWindsor.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Boxes.Integration.Extensions; +using Boxes.Integration.Factories; +using Castle.MicroKernel.Resolvers.SpecializedResolvers; +using Castle.Windsor; + +namespace Container.Windsor +{ + public class SetupWindsor : IIocSetup, IBoxesExtension + { + public void Configure(IWindsorContainer builder) + { + builder.Kernel.Resolver.AddSubResolver(new CollectionResolver(builder.Kernel, true)); + } + + public void ConfigureChild(IWindsorContainer builder) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/Container.Windsor/manifest.xml b/src/Container.Windsor/manifest.xml new file mode 100644 index 0000000..5e09c6d --- /dev/null +++ b/src/Container.Windsor/manifest.xml @@ -0,0 +1,15 @@ + + + Container.Windsor + 1.0.0 + Defines the Process interface and a default implementation + + + + + + + + + + \ No newline at end of file diff --git a/src/Container.Windsor/packages.config b/src/Container.Windsor/packages.config new file mode 100644 index 0000000..39ae7d1 --- /dev/null +++ b/src/Container.Windsor/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/Identifiers.Windsor/Extension.cs b/src/Identifiers.Windsor/Extension.cs index 3dc6119..bb4d0ce 100644 --- a/src/Identifiers.Windsor/Extension.cs +++ b/src/Identifiers.Windsor/Extension.cs @@ -1,42 +1,43 @@ +using Boxes.Integration.Setup; +using Boxes.Integration.Setup.Registrations; +using Boxes.Windsor; +using Castle.Windsor; + namespace Identifiers.Windsor { - using Boxes.Integration; - using Boxes.Integration.ContainerSetup; using Boxes.Integration.Extensions; using Castle.MicroKernel.Lifestyle; - public class Extension : IBoxesExtension + public class Extension : ISetupBoxesExtension> { - public void Extend(IBoxesWrapper boxes) + public bool CanHandle(IDefaultContainerSetup extension) + { + return true; + } + + public void Configure(IDefaultContainerSetup containerSetup) { - var singleton = new Registration() + containerSetup.AddRegistration(new Register() .Where(x => typeof(ISingletonDependency).IsAssignableFrom(x)) - .LifeStyle() - .RegisterWith(RegisterWith.SelfAndAllInterfaces); + .LifeStyle(typeof(SingletonLifestyleManager)) + .AssociateWith(Contracts.SelfAndAllInterfaces)); - var tranient = new Registration() + containerSetup.AddRegistration(new Register() .Where(x => typeof(ITransientDependency).IsAssignableFrom(x)) - .LifeStyle() - .RegisterWith(RegisterWith.SelfAndAllInterfaces); + .LifeStyle(typeof(TransientLifestyleManager)) + .AssociateWith(Contracts.SelfAndAllInterfaces)); - var singletonAttr = new Registration() + containerSetup.AddRegistration(new Register() .Where(x => x.HasAttribute()) - .LifeStyle() - .RegisterWith(RegisterWith.SelfAndAllInterfaces); + .LifeStyle(typeof(SingletonLifestyleManager)) + .AssociateWith(Contracts.SelfAndAllInterfaces)); - var tranientAttr = new Registration() + containerSetup.AddRegistration(new Register() .Where(x => x.HasAttribute()) - .LifeStyle() - .RegisterWith(RegisterWith.SelfAndAllInterfaces); - - - boxes.BoxesContainerSetup.RegisterLifeStyle(tranient); - boxes.BoxesContainerSetup.RegisterLifeStyle(singleton); - - boxes.BoxesContainerSetup.RegisterLifeStyle(tranientAttr); - boxes.BoxesContainerSetup.RegisterLifeStyle(singletonAttr); + .LifeStyle(typeof(TransientLifestyleManager)) + .AssociateWith(Contracts.SelfAndAllInterfaces)); - boxes.BoxesIntegrationSetup.AddPackgeLevelFilter(new Filter(), "Identifiers"); + containerSetup.AddPackgeLevelFilter(new Filter(), "Identifiers"); } } } \ No newline at end of file diff --git a/src/Identifiers.Windsor/Filter.cs b/src/Identifiers.Windsor/Filter.cs index 0826edd..3f8a224 100644 --- a/src/Identifiers.Windsor/Filter.cs +++ b/src/Identifiers.Windsor/Filter.cs @@ -1,12 +1,13 @@ +using Boxes.Integration.Setup.Filters; + namespace Identifiers.Windsor { using System; using System.Collections.Generic; using System.Linq; using Boxes; - using Boxes.Integration.Setup; - public class Filter : IPackageTypesFilter + public class Filter : ITypeRegistrationFilter { public IEnumerable FilterTypes(Package package) { diff --git a/src/Identifiers.Windsor/Identifiers.Windsor.csproj b/src/Identifiers.Windsor/Identifiers.Windsor.csproj index 9f7a849..641cf3a 100644 --- a/src/Identifiers.Windsor/Identifiers.Windsor.csproj +++ b/src/Identifiers.Windsor/Identifiers.Windsor.csproj @@ -33,22 +33,26 @@ - ..\packages\Boxes.Core.0.1.17\lib\net40\Boxes.Core.dll + ..\packages\Boxes.Core.0.3.27\lib\net40\Boxes.Core.dll - ..\packages\Boxes.Integration.0.1.6\lib\net40\Boxes.Integration.dll + ..\packages\Boxes.Integration.0.3.16\lib\net40\Boxes.Integration.dll + + + False + ..\packages\Boxes.Windsor.0.3.17\lib\net40\Boxes.Windsor.dll ..\packages\Castle.Core.3.2.0\lib\net45\Castle.Core.dll False - ..\packages\Castle.Windsor.3.2.0\lib\net45\Castle.Windsor.dll - False + ..\packages\Castle.Windsor.3.2.1\lib\net45\Castle.Windsor.dll + diff --git a/src/Identifiers.Windsor/packages.config b/src/Identifiers.Windsor/packages.config index 670242d..39ae7d1 100644 --- a/src/Identifiers.Windsor/packages.config +++ b/src/Identifiers.Windsor/packages.config @@ -1,7 +1,8 @@  - - + + + - + \ No newline at end of file diff --git a/src/Process/Application.cs b/src/Process/Application.cs new file mode 100644 index 0000000..c8c39d9 --- /dev/null +++ b/src/Process/Application.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using Boxes.Integration; +using Boxes.Integration.Setup; + +namespace Process +{ + /// + /// the application level is to register components which are shared between tenants. components which are enabled at this level should be able to handle tenancy. + /// + public class Application + { + /// + /// the packages the application requires (this does not mean they could be enabled) + /// + public IEnumerable Packages { get; set; } + + /// + /// the enabled packages + /// + public IEnumerable EnabledPackages { get; set; } + + /// + /// the container for the applicaiton + /// + public object Container { get; set; } + + } + + ///// + ///// the global container setup + ///// + ///// the ioc builder class + //public interface IApplicationContainerSetup : IContainerSetup { } + + //public class ApplicationContainerSetup : ContainerSetupBase, IApplicationContainerSetup + //{ + // public ApplicationContainerSetup(IRegistrationTaskMapper registrationTaskMapper) + // : base(registrationTaskMapper) + // { + // } + //} + +} \ No newline at end of file diff --git a/src/Process/DefaultPackageLoader.cs b/src/Process/DefaultPackageLoader.cs new file mode 100644 index 0000000..3f1227e --- /dev/null +++ b/src/Process/DefaultPackageLoader.cs @@ -0,0 +1,83 @@ +namespace Process +{ + using Boxes.Integration; + using Boxes.Integration.Setup; + using Boxes.Integration.Setup.Filters; + using System.Collections.Generic; + using System.Linq; + using Boxes; + using Boxes.Integration.Process; + using Boxes.Integration.Factories; + using Boxes.Integration.Trust; + + + public class DefaultPackageLoader : ILoadProcess + { + private readonly PackageRegistry _packageRegistry; + private readonly IIocFactory _ioCFactory; + private readonly IProcessOrder _processOrder; + private readonly IDefaultContainerSetup _containerSetup; + private readonly ITrustManager _trustManager; + + private readonly PipelineExecutorWrapper> _iocPipeline = new PipelineExecutorWrapper>(); + + public DefaultPackageLoader( + PackageRegistry packageRegistry, + IIocFactory ioCFactory, + IProcessOrder processOrder, + IDefaultContainerSetup containerSetup, + ITrustManager trustManager) + { + _packageRegistry = packageRegistry; + _ioCFactory = ioCFactory; + _processOrder = processOrder; + _containerSetup = containerSetup; + _trustManager = trustManager; + } + + public void LoadPackages(Application application, IEnumerable packagesToEnable) + { + application.Container.TryDispose(); + var builder = _ioCFactory.CreateBuilder(); + + //TODO: check if there are any missing packages, which also need to be enabled + + var loadablePackages = + _packageRegistry.Packages + .Where(x => x.CanLoad); + //.Where(x => packagesToEnable.Contains(x.Name)); + + //get process Order + IEnumerable packages = _processOrder.Arrange(loadablePackages); + + //find the types in each package (filter as much as we can) + var processContexts = + packages.Select( + x => + { + ITypeRegistrationFilter typesFilter = _containerSetup.GetTypeRegistrationFilter(x.Name) ?? + _containerSetup.DefaultTypeRegistrationFilter; + + var context = new ProcessPackageContext(x, typesFilter.FilterTypes(x).ToArray()); + + //TODO: check to see if the context is trusted + + return context; + }).ToList(); //save the result, as we may need multiple iterations + + //we need to register all the types with the tenants IoC first + IEnumerable> registrationContexts = + processContexts + .SelectMany(x => x.DependencyTypes) + .Select(x => new RegistrationContext(x, builder)); + + _iocPipeline.UpdateTasksAsRequired(_containerSetup.Registrations); + _iocPipeline.Execute(registrationContexts).Force(); + + + //create the container from the builder (if required) + var container = _ioCFactory.CreateContainer(builder); + application.Container = container; + } + } +} \ No newline at end of file diff --git a/src/Process/ILoadProcess.cs b/src/Process/ILoadProcess.cs new file mode 100644 index 0000000..3b5ab3f --- /dev/null +++ b/src/Process/ILoadProcess.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using Boxes.Integration.Extensions; + +namespace Process +{ + public interface ILoadProcess : IBoxesExtension + { + void LoadPackages(Application context, IEnumerable packagesToEnable); + } +} \ No newline at end of file diff --git a/src/Process/PipelineExecutorWrapper.cs b/src/Process/PipelineExecutorWrapper.cs new file mode 100644 index 0000000..c66eb75 --- /dev/null +++ b/src/Process/PipelineExecutorWrapper.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using System.Linq; +using Boxes; +using Boxes.Tasks; + +namespace Process +{ + /// + /// + /// + /// + public class PipelineExecutorWrapper + { + private ICollection> _tasks; + private PipilineExecutor _pipilineExecutor; + + private int _numberOfRegistrations = -1; + + public PipelineExecutorWrapper() { } + + public PipelineExecutorWrapper(IEnumerable> tasks) + { + _tasks = tasks as ICollection> ?? tasks.ToList(); + } + + public void UpdateTasksAsRequired(IEnumerable> tasks) + { + _tasks = tasks as ICollection> ?? tasks.ToList(); + UpdateTasksAsRequired(); + } + + public void UpdateTasksAsRequired() + { + var currentNumberOfRegistrations = _tasks.Count(); + + if (currentNumberOfRegistrations == _numberOfRegistrations) + { + return; + } + _numberOfRegistrations = currentNumberOfRegistrations; + _pipilineExecutor = _tasks.CreatePipeline(); + } + + public IEnumerable Execute(IEnumerable item) + { + return _pipilineExecutor.Execute(item); + } + } +} \ No newline at end of file diff --git a/src/Process/Process.csproj b/src/Process/Process.csproj new file mode 100644 index 0000000..c393921 --- /dev/null +++ b/src/Process/Process.csproj @@ -0,0 +1,79 @@ + + + + + Debug + AnyCPU + {9147EF1B-645B-4B6F-819D-61EBFF66B43D} + Library + Properties + Process + Process + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Boxes.Core.0.3.27\lib\net40\Boxes.Core.dll + + + ..\packages\Boxes.Integration.0.3.16\lib\net40\Boxes.Integration.dll + + + ..\packages\Boxes.Windsor.0.3.17\lib\net40\Boxes.Windsor.dll + + + ..\packages\Castle.Core.3.2.0\lib\net45\Castle.Core.dll + + + ..\packages\Castle.Windsor.3.2.1\lib\net45\Castle.Windsor.dll + + + + + + + + + + + + + + + + + + + + + + Always + + + + + \ No newline at end of file diff --git a/src/Process/Properties/AssemblyInfo.cs b/src/Process/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a9123a3 --- /dev/null +++ b/src/Process/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Process")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Process")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("cc15fa53-8903-4484-8c3a-ab9c50cbbd8c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Process/manifest.xml b/src/Process/manifest.xml new file mode 100644 index 0000000..a80cb9c --- /dev/null +++ b/src/Process/manifest.xml @@ -0,0 +1,15 @@ + + + Process + 1.0.0 + Defines the Process interface and a default implementation + + + + + + + + + + \ No newline at end of file diff --git a/src/Process/packages.config b/src/Process/packages.config new file mode 100644 index 0000000..39ae7d1 --- /dev/null +++ b/src/Process/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file From f9602e4432c678bce280befade8653f736f44a3c Mon Sep 17 00:00:00 2001 From: David Rundle Date: Fri, 18 Oct 2013 02:45:08 +0100 Subject: [PATCH 2/2] 0.4.x demo --- src/Aspects.Windsor/Aspects.Windsor.csproj | 90 +++++++++++++++++++ src/Aspects.Windsor/Extensions.cs | 28 ++++++ .../Properties/AssemblyInfo.cs | 36 ++++++++ src/Aspects.Windsor/manifest.xml | 14 +++ src/Aspects.Windsor/packages.config | 8 ++ src/Aspects/Aspects.csproj | 74 +++++++++++++++ src/Aspects/LoggingInterceptor.cs | 28 ++++++ src/Aspects/Properties/AssemblyInfo.cs | 36 ++++++++ src/Aspects/manifest.xml | 12 +++ src/Aspects/packages.config | 6 ++ src/Calc.CommandLine/Calc.CommandLine.csproj | 15 ++-- src/Calc.CommandLine/Program.cs | 7 -- src/Calc.CommandLine/packages.config | 6 +- src/Calculator.Boxes.sln | 14 +++ src/Calculator.Boxes.sln.DotSettings | 2 + .../Container.Windsor.csproj | 12 ++- src/Container.Windsor/packages.config | 6 +- src/Identifiers.Windsor/Extension.cs | 1 + .../Identifiers.Windsor.csproj | 10 +-- src/Identifiers.Windsor/packages.config | 6 +- src/Process/Application.cs | 15 ---- src/Process/Process.csproj | 12 ++- src/Process/manifest.xml | 2 +- src/Process/packages.config | 6 +- 24 files changed, 386 insertions(+), 60 deletions(-) create mode 100644 src/Aspects.Windsor/Aspects.Windsor.csproj create mode 100644 src/Aspects.Windsor/Extensions.cs create mode 100644 src/Aspects.Windsor/Properties/AssemblyInfo.cs create mode 100644 src/Aspects.Windsor/manifest.xml create mode 100644 src/Aspects.Windsor/packages.config create mode 100644 src/Aspects/Aspects.csproj create mode 100644 src/Aspects/LoggingInterceptor.cs create mode 100644 src/Aspects/Properties/AssemblyInfo.cs create mode 100644 src/Aspects/manifest.xml create mode 100644 src/Aspects/packages.config diff --git a/src/Aspects.Windsor/Aspects.Windsor.csproj b/src/Aspects.Windsor/Aspects.Windsor.csproj new file mode 100644 index 0000000..8b21e48 --- /dev/null +++ b/src/Aspects.Windsor/Aspects.Windsor.csproj @@ -0,0 +1,90 @@ + + + + + Debug + AnyCPU + {1D0F1178-5D7F-4C3D-9267-2A33C7527B86} + Library + Properties + Aspects.Windsor + Aspects.Windsor + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Boxes.Core.0.4.31\lib\net40\Boxes.Core.dll + False + + + ..\packages\Boxes.Integration.0.4.24\lib\net40\Boxes.Integration.dll + False + + + ..\packages\Boxes.Windsor.0.4.25\lib\net40\Boxes.Windsor.dll + False + + + ..\packages\Castle.Core.3.2.0\lib\net45\Castle.Core.dll + False + + + ..\packages\Castle.Windsor.3.2.1\lib\net45\Castle.Windsor.dll + False + + + + + + + + + + + + + + + + {c6a4783c-22e9-4dba-8184-9ef2c7cf604a} + Aspects + False + + + {5F873342-D9A3-49AD-9398-3391350C124A} + Identifiers + False + + + + + Always + + + + + \ No newline at end of file diff --git a/src/Aspects.Windsor/Extensions.cs b/src/Aspects.Windsor/Extensions.cs new file mode 100644 index 0000000..e01984c --- /dev/null +++ b/src/Aspects.Windsor/Extensions.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Aspects.Windsor +{ + using Boxes.Integration.Extensions; + using Boxes.Integration.Setup; + using Boxes.Integration.Setup.Interception; + using Castle.Windsor; + + public class Extensions : ISetupBoxesExtension> + { + public bool CanHandle(IDefaultContainerSetup extension) + { + return true; + } + + public void Configure(IDefaultContainerSetup config) + { + config.AddInterception(new RegisterInterception() + .Apply() + .Where(ctx => ctx.Service.Name.EndsWith("Command"))); + } + } +} diff --git a/src/Aspects.Windsor/Properties/AssemblyInfo.cs b/src/Aspects.Windsor/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..27c1c42 --- /dev/null +++ b/src/Aspects.Windsor/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Aspects.Windsor")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Aspects.Windsor")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4417580f-4366-4440-b9a1-3fcc2f314ea9")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Aspects.Windsor/manifest.xml b/src/Aspects.Windsor/manifest.xml new file mode 100644 index 0000000..7262f1a --- /dev/null +++ b/src/Aspects.Windsor/manifest.xml @@ -0,0 +1,14 @@ + + + Aspects.Windsor + 1.0.0 + Extends Boxes.Integration to use aspects + + + + + + + + + \ No newline at end of file diff --git a/src/Aspects.Windsor/packages.config b/src/Aspects.Windsor/packages.config new file mode 100644 index 0000000..bbd52e6 --- /dev/null +++ b/src/Aspects.Windsor/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/Aspects/Aspects.csproj b/src/Aspects/Aspects.csproj new file mode 100644 index 0000000..1803356 --- /dev/null +++ b/src/Aspects/Aspects.csproj @@ -0,0 +1,74 @@ + + + + + Debug + AnyCPU + {C6A4783C-22E9-4DBA-8184-9EF2C7CF604A} + Library + Properties + Aspects + Aspects + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Boxes.Core.0.4.31\lib\net40\Boxes.Core.dll + + + ..\packages\Boxes.Integration.0.4.24\lib\net40\Boxes.Integration.dll + + + ..\packages\Castle.Core.3.2.0\lib\net45\Castle.Core.dll + False + + + + + + + + + + + + + + + Always + + + + + {5f873342-d9a3-49ad-9398-3391350c124a} + Identifiers + False + + + + + \ No newline at end of file diff --git a/src/Aspects/LoggingInterceptor.cs b/src/Aspects/LoggingInterceptor.cs new file mode 100644 index 0000000..1103799 --- /dev/null +++ b/src/Aspects/LoggingInterceptor.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Aspects +{ + using Castle.DynamicProxy; + using Identifiers; + + public class LoggingInterceptor : IInterceptor, ITransientDependency + { + public void Intercept(IInvocation invocation) + { + //over simplified... + try + { + invocation.Proceed(); + } + catch (Exception) + { + Console.WriteLine("had issues running: {0}", invocation.TargetType.Name); + invocation.ReturnValue = ""; + } + } + } +} diff --git a/src/Aspects/Properties/AssemblyInfo.cs b/src/Aspects/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..56ea02d --- /dev/null +++ b/src/Aspects/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Aspects")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Aspects")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6fa60b3e-e5cc-4005-ae82-6d632d2e2036")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Aspects/manifest.xml b/src/Aspects/manifest.xml new file mode 100644 index 0000000..3b0380d --- /dev/null +++ b/src/Aspects/manifest.xml @@ -0,0 +1,12 @@ + + + Aspects + 1.0.0 + AOP interceptors + + + + + + + \ No newline at end of file diff --git a/src/Aspects/packages.config b/src/Aspects/packages.config new file mode 100644 index 0000000..9c94ccc --- /dev/null +++ b/src/Aspects/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Calc.CommandLine/Calc.CommandLine.csproj b/src/Calc.CommandLine/Calc.CommandLine.csproj index c085cfe..c769a14 100644 --- a/src/Calc.CommandLine/Calc.CommandLine.csproj +++ b/src/Calc.CommandLine/Calc.CommandLine.csproj @@ -34,14 +34,17 @@ 4 - - ..\packages\Boxes.Core.0.3.27\lib\net40\Boxes.Core.dll + + False + ..\packages\Boxes.Core.0.4.31\lib\net40\Boxes.Core.dll - - ..\packages\Boxes.Integration.0.3.16\lib\net40\Boxes.Integration.dll + + False + ..\packages\Boxes.Integration.0.4.24\lib\net40\Boxes.Integration.dll - - ..\packages\Boxes.Windsor.0.3.17\lib\net40\Boxes.Windsor.dll + + False + ..\packages\Boxes.Windsor.0.4.25\lib\net40\Boxes.Windsor.dll ..\packages\Castle.Core.3.2.0\lib\net45\Castle.Core.dll diff --git a/src/Calc.CommandLine/Program.cs b/src/Calc.CommandLine/Program.cs index 26921e1..0fd2d0b 100644 --- a/src/Calc.CommandLine/Program.cs +++ b/src/Calc.CommandLine/Program.cs @@ -88,13 +88,6 @@ private static IBoxesWrapper CreateBoxesWr var packageScanner = new PackageScanner(packageDirectory); packageScanner.SetManifestTask(xmlManifestTask); - //you can setup the container before hand - var iocSetup = - new FuncIocSetup( - container => container.Kernel.Resolver.AddSubResolver(new CollectionResolver(container.Kernel, true)), - childContainer =>{} ); - - //the main bit for using boxes var boxes = new BoxesWrapper(); boxes.Setup(packageScanner); diff --git a/src/Calc.CommandLine/packages.config b/src/Calc.CommandLine/packages.config index 39ae7d1..bbd52e6 100644 --- a/src/Calc.CommandLine/packages.config +++ b/src/Calc.CommandLine/packages.config @@ -1,8 +1,8 @@  - - - + + + \ No newline at end of file diff --git a/src/Calculator.Boxes.sln b/src/Calculator.Boxes.sln index 5173341..49e9e54 100644 --- a/src/Calculator.Boxes.sln +++ b/src/Calculator.Boxes.sln @@ -19,6 +19,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Process", "Process\Process. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Container.Windsor", "Container.Windsor\Container.Windsor.csproj", "{2BC4EA02-F00F-4DAE-96FC-FAD46E5377CD}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aspects", "Aspects\Aspects.csproj", "{C6A4783C-22E9-4DBA-8184-9EF2C7CF604A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aspects.Windsor", "Aspects.Windsor\Aspects.Windsor.csproj", "{1D0F1178-5D7F-4C3D-9267-2A33C7527B86}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -57,6 +61,14 @@ Global {2BC4EA02-F00F-4DAE-96FC-FAD46E5377CD}.Debug|Any CPU.Build.0 = Debug|Any CPU {2BC4EA02-F00F-4DAE-96FC-FAD46E5377CD}.Release|Any CPU.ActiveCfg = Release|Any CPU {2BC4EA02-F00F-4DAE-96FC-FAD46E5377CD}.Release|Any CPU.Build.0 = Release|Any CPU + {C6A4783C-22E9-4DBA-8184-9EF2C7CF604A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C6A4783C-22E9-4DBA-8184-9EF2C7CF604A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C6A4783C-22E9-4DBA-8184-9EF2C7CF604A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C6A4783C-22E9-4DBA-8184-9EF2C7CF604A}.Release|Any CPU.Build.0 = Release|Any CPU + {1D0F1178-5D7F-4C3D-9267-2A33C7527B86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1D0F1178-5D7F-4C3D-9267-2A33C7527B86}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1D0F1178-5D7F-4C3D-9267-2A33C7527B86}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1D0F1178-5D7F-4C3D-9267-2A33C7527B86}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -69,5 +81,7 @@ Global {BA5646E1-05CA-4167-BA95-BC3C3E04C290} = {46BFBE3A-9B79-4339-A694-7E4C038FF058} {9147EF1B-645B-4B6F-819D-61EBFF66B43D} = {46BFBE3A-9B79-4339-A694-7E4C038FF058} {2BC4EA02-F00F-4DAE-96FC-FAD46E5377CD} = {46BFBE3A-9B79-4339-A694-7E4C038FF058} + {C6A4783C-22E9-4DBA-8184-9EF2C7CF604A} = {46BFBE3A-9B79-4339-A694-7E4C038FF058} + {1D0F1178-5D7F-4C3D-9267-2A33C7527B86} = {46BFBE3A-9B79-4339-A694-7E4C038FF058} EndGlobalSection EndGlobal diff --git a/src/Calculator.Boxes.sln.DotSettings b/src/Calculator.Boxes.sln.DotSettings index 11f2c26..7a752af 100644 --- a/src/Calculator.Boxes.sln.DotSettings +++ b/src/Calculator.Boxes.sln.DotSettings @@ -1,3 +1,5 @@  + True + True <data><IncludeFilters /><ExcludeFilters /></data> <data /> \ No newline at end of file diff --git a/src/Container.Windsor/Container.Windsor.csproj b/src/Container.Windsor/Container.Windsor.csproj index 63bd472..8e72a85 100644 --- a/src/Container.Windsor/Container.Windsor.csproj +++ b/src/Container.Windsor/Container.Windsor.csproj @@ -31,27 +31,25 @@ - ..\packages\Boxes.Core.0.3.27\lib\net40\Boxes.Core.dll + ..\packages\Boxes.Core.0.4.31\lib\net40\Boxes.Core.dll - ..\packages\Boxes.Integration.0.3.16\lib\net40\Boxes.Integration.dll + ..\packages\Boxes.Integration.0.4.24\lib\net40\Boxes.Integration.dll - ..\packages\Boxes.Windsor.0.3.17\lib\net40\Boxes.Windsor.dll + ..\packages\Boxes.Windsor.0.4.25\lib\net40\Boxes.Windsor.dll ..\packages\Castle.Core.3.2.0\lib\net45\Castle.Core.dll + False ..\packages\Castle.Windsor.3.2.1\lib\net45\Castle.Windsor.dll + False - - - - diff --git a/src/Container.Windsor/packages.config b/src/Container.Windsor/packages.config index 39ae7d1..bbd52e6 100644 --- a/src/Container.Windsor/packages.config +++ b/src/Container.Windsor/packages.config @@ -1,8 +1,8 @@  - - - + + + \ No newline at end of file diff --git a/src/Identifiers.Windsor/Extension.cs b/src/Identifiers.Windsor/Extension.cs index bb4d0ce..01cd118 100644 --- a/src/Identifiers.Windsor/Extension.cs +++ b/src/Identifiers.Windsor/Extension.cs @@ -6,6 +6,7 @@ namespace Identifiers.Windsor { using Boxes.Integration.Extensions; + using Boxes.Integration.Setup.Interception; using Castle.MicroKernel.Lifestyle; public class Extension : ISetupBoxesExtension> diff --git a/src/Identifiers.Windsor/Identifiers.Windsor.csproj b/src/Identifiers.Windsor/Identifiers.Windsor.csproj index 641cf3a..7d02fd3 100644 --- a/src/Identifiers.Windsor/Identifiers.Windsor.csproj +++ b/src/Identifiers.Windsor/Identifiers.Windsor.csproj @@ -33,14 +33,13 @@ - ..\packages\Boxes.Core.0.3.27\lib\net40\Boxes.Core.dll + ..\packages\Boxes.Core.0.4.31\lib\net40\Boxes.Core.dll - ..\packages\Boxes.Integration.0.3.16\lib\net40\Boxes.Integration.dll + ..\packages\Boxes.Integration.0.4.24\lib\net40\Boxes.Integration.dll - - False - ..\packages\Boxes.Windsor.0.3.17\lib\net40\Boxes.Windsor.dll + + ..\packages\Boxes.Windsor.0.4.25\lib\net40\Boxes.Windsor.dll ..\packages\Castle.Core.3.2.0\lib\net45\Castle.Core.dll @@ -48,6 +47,7 @@ ..\packages\Castle.Windsor.3.2.1\lib\net45\Castle.Windsor.dll + False diff --git a/src/Identifiers.Windsor/packages.config b/src/Identifiers.Windsor/packages.config index 39ae7d1..bbd52e6 100644 --- a/src/Identifiers.Windsor/packages.config +++ b/src/Identifiers.Windsor/packages.config @@ -1,8 +1,8 @@  - - - + + + \ No newline at end of file diff --git a/src/Process/Application.cs b/src/Process/Application.cs index c8c39d9..2ef57a8 100644 --- a/src/Process/Application.cs +++ b/src/Process/Application.cs @@ -25,19 +25,4 @@ public class Application public object Container { get; set; } } - - ///// - ///// the global container setup - ///// - ///// the ioc builder class - //public interface IApplicationContainerSetup : IContainerSetup { } - - //public class ApplicationContainerSetup : ContainerSetupBase, IApplicationContainerSetup - //{ - // public ApplicationContainerSetup(IRegistrationTaskMapper registrationTaskMapper) - // : base(registrationTaskMapper) - // { - // } - //} - } \ No newline at end of file diff --git a/src/Process/Process.csproj b/src/Process/Process.csproj index c393921..f0894ea 100644 --- a/src/Process/Process.csproj +++ b/src/Process/Process.csproj @@ -31,27 +31,25 @@ - ..\packages\Boxes.Core.0.3.27\lib\net40\Boxes.Core.dll + ..\packages\Boxes.Core.0.4.31\lib\net40\Boxes.Core.dll - ..\packages\Boxes.Integration.0.3.16\lib\net40\Boxes.Integration.dll + ..\packages\Boxes.Integration.0.4.24\lib\net40\Boxes.Integration.dll - ..\packages\Boxes.Windsor.0.3.17\lib\net40\Boxes.Windsor.dll + ..\packages\Boxes.Windsor.0.4.25\lib\net40\Boxes.Windsor.dll ..\packages\Castle.Core.3.2.0\lib\net45\Castle.Core.dll + False ..\packages\Castle.Windsor.3.2.1\lib\net45\Castle.Windsor.dll + False - - - - diff --git a/src/Process/manifest.xml b/src/Process/manifest.xml index a80cb9c..7900d41 100644 --- a/src/Process/manifest.xml +++ b/src/Process/manifest.xml @@ -4,7 +4,7 @@ 1.0.0 Defines the Process interface and a default implementation - + diff --git a/src/Process/packages.config b/src/Process/packages.config index 39ae7d1..bbd52e6 100644 --- a/src/Process/packages.config +++ b/src/Process/packages.config @@ -1,8 +1,8 @@  - - - + + + \ No newline at end of file