diff --git a/src/Boxes.Integration/Boxes.Integration.csproj b/src/Boxes.Integration/Boxes.Integration.csproj
index e59a41d..e196c6a 100644
--- a/src/Boxes.Integration/Boxes.Integration.csproj
+++ b/src/Boxes.Integration/Boxes.Integration.csproj
@@ -45,6 +45,9 @@
+
+
+
@@ -70,7 +73,7 @@
-
+
diff --git a/src/Boxes.Integration/BoxesWrapperBase.cs b/src/Boxes.Integration/BoxesWrapperBase.cs
index 85677d4..61e0c67 100644
--- a/src/Boxes.Integration/BoxesWrapperBase.cs
+++ b/src/Boxes.Integration/BoxesWrapperBase.cs
@@ -31,11 +31,16 @@ public abstract class BoxesWrapperBase : IBoxesWrapper
//issue is around the containers, a subset allow to deletions of registrations
//an other way is to restart the app and only register the required packages with the IoC
//the second way can be supported by coding a module
+ //favoured way, use of child container, will need to re-initialise the container (delete, create a new one)
//TODO: migrations
//updates of a module will require a restart, currently the Loaders do not support
//app domains. they do offer a level of isolation
+ //TODO: Multi-tenancy
+ //use child containers to handle tenants. implement a IProcess (consider PLinq) to register
+ //the correct packages with the correct child container.
+
///
/// the main process line, add tasks to this, and they will be executed
/// in the order defined by
@@ -123,6 +128,8 @@ public virtual void LoadPackages()
//process extensions first (in complete, before running the rest of the package or process)
_setup.ExtensionRunner.Execute(loader.Packages).Force();
+ //TODO: push the following into a separate interface
+
//filter out the packages which are not in use.
IEnumerable filteredPackages =
_setup.GlobalPackagesFilter == null
diff --git a/src/Boxes.Integration/ContainerSetup/BoxesContainerSetupBase.cs b/src/Boxes.Integration/ContainerSetup/BoxesContainerSetupBase.cs
index e0fb0ab..76f7d39 100644
--- a/src/Boxes.Integration/ContainerSetup/BoxesContainerSetupBase.cs
+++ b/src/Boxes.Integration/ContainerSetup/BoxesContainerSetupBase.cs
@@ -25,16 +25,17 @@ public abstract class BoxesContainerSetupBase : IBoxesContainerSetup
public abstract void RegisterLifeStyle();
- public void RegisterLifeStyle(Registration registration)
+ public void RegisterLifeStyle(IRegister registration)
{
- RegisterLifeStyle(registration.RegistrationMeta);
+ AddRegistration(registration);
}
- protected abstract void RegisterLifeStyle(RegistrationMeta registration);
-
- protected void AddRegistrationTask(IBoxesTask registrationTask)
+ public void AddRegistration(IRegister registration)
{
- _registraionTasks.Add(registrationTask);
+ var task = CreateRegisterTask(registration.RegistrationMeta);
+ _registraionTasks.Add(task);
}
+
+ protected abstract IBoxesTask CreateRegisterTask(RegistrationMeta registration);
}
}
\ No newline at end of file
diff --git a/src/Boxes.Integration/ContainerSetup/RegisterWith.cs b/src/Boxes.Integration/ContainerSetup/Contracts.cs
similarity index 88%
rename from src/Boxes.Integration/ContainerSetup/RegisterWith.cs
rename to src/Boxes.Integration/ContainerSetup/Contracts.cs
index 6e4454d..d039379 100644
--- a/src/Boxes.Integration/ContainerSetup/RegisterWith.cs
+++ b/src/Boxes.Integration/ContainerSetup/Contracts.cs
@@ -13,10 +13,12 @@
// limitations under the License.
namespace Boxes.Integration.ContainerSetup
{
+ using System;
+
///
- /// Register with which services
+ /// Register with which service contracts
///
- public enum RegisterWith
+ public enum Contracts
{
///
/// All the interfaces
@@ -38,4 +40,10 @@ public enum RegisterWith
///
SelfAndAllInterfaces
}
+
+ [Obsolete("Use Contracts", true)]
+ public enum RegisterWith
+ {
+
+ }
}
\ No newline at end of file
diff --git a/src/Boxes.Integration/ContainerSetup/IBoxesContainerSetup.cs b/src/Boxes.Integration/ContainerSetup/IBoxesContainerSetup.cs
index 30439ac..fbe8477 100644
--- a/src/Boxes.Integration/ContainerSetup/IBoxesContainerSetup.cs
+++ b/src/Boxes.Integration/ContainerSetup/IBoxesContainerSetup.cs
@@ -32,13 +32,20 @@ public interface IBoxesContainerSetup
///
/// The lifestyle manager to use
/// The Dependency interface to register with the lifecycle
- [Obsolete("use the other overload")]
+ [Obsolete("use AddRegistration", true)]
void RegisterLifeStyle();
///
/// Register a type (can be as simple as does it implement a Dependency or to apply a filter)
///
/// The registration with details on how setup the IoC with the types which match the where clause
- void RegisterLifeStyle(Registration registration);
+ [Obsolete("use AddRegistration")]
+ void RegisterLifeStyle(IRegister registration);
+
+ ///
+ /// Register a type (can be as simple as does it implement a Dependency or to apply a filter)
+ ///
+ /// The registration with details on how setup the IoC with the types which match the where clause
+ void AddRegistration(IRegister registration);
}
}
\ No newline at end of file
diff --git a/src/Boxes.Integration/ContainerSetup/IRegister.cs b/src/Boxes.Integration/ContainerSetup/IRegister.cs
new file mode 100644
index 0000000..ee686ab
--- /dev/null
+++ b/src/Boxes.Integration/ContainerSetup/IRegister.cs
@@ -0,0 +1,74 @@
+namespace Boxes.Integration.ContainerSetup
+{
+ using System;
+ using System.Collections.Generic;
+
+ ///
+ /// This class provides a mechanism to setup the registration of types with the underlying IoC.
+ ///
+ public interface IRegister
+ {
+ ///
+ /// meta information about the registration
+ ///
+ RegistrationMeta RegistrationMeta { get; }
+ }
+
+ ///
+ /// This class provides a mechanism to setup the registration of types with the underlying IoC.
+ ///
+ /// The signature for the scope/lifestyle
+ /// the IoC direct configuration for the current registration
+ public interface IRegister : IRegister
+ {
+ ///
+ /// apply a filter (pattern) to find which types this registration will apply too
+ ///
+ /// the pattern to find the types this registration applies too
+ IRegister Where(Predicate where);
+
+ ///
+ /// which contracts to associate the current type with
+ ///
+ /// select the appropriate contracts to register this class with
+ IRegister AssociateWith(Contracts contracts);
+
+ ///
+ /// which contracts to associate the current type with
+ ///
+ /// provide a list of contracts to associate the current type with
+ IRegister AssociateWith(Func> contracts);
+
+ ///
+ /// which contracts to associate the current type with
+ ///
+ /// provide a list of contracts to associate the current type with
+ IRegister AssociateWith(IEnumerable contracts);
+
+ ///
+ /// supply a ctor to use, apply this in the Configure Method, as this will allow direct access
+ /// to the actual IoC's registration
+ ///
+ /// the ctor to use
+ [Obsolete("not all IoC's support this", true)]
+ IRegister Ctor(Func