From ceda93440c9d8a8efe2dd5312bc778089c3324ba Mon Sep 17 00:00:00 2001 From: "B. Nordli" Date: Sat, 7 Jan 2017 11:13:13 +0100 Subject: [PATCH] Do not expose DefaultLifecycle from IContainer. #716 Instead clients should set the default lifecycle on the container either before returning from ICanCreateContainer.CreateContainer or before the call to Configure.With. Original issue: ProCoSys/Bifrost#16 --- Source/Bifrost.Autofac/Container.cs | 46 +-- Source/Bifrost.Ninject/Container.cs | 18 +- Source/Bifrost.SimpleInjector/Container.cs | 40 ++- .../ContainerExtensions.cs | 8 + Source/Bifrost.StructureMap/Container.cs | 296 +++++++++--------- Source/Bifrost/Configuration/Configure.cs | 85 ++--- .../ExecutionContextConfiguration.cs | 2 +- Source/Bifrost/Configuration/IConfigure.cs | 85 +++-- Source/Bifrost/Execution/IContainer.cs | 9 +- 9 files changed, 282 insertions(+), 307 deletions(-) diff --git a/Source/Bifrost.Autofac/Container.cs b/Source/Bifrost.Autofac/Container.cs index 360376830..4b055b29c 100644 --- a/Source/Bifrost.Autofac/Container.cs +++ b/Source/Bifrost.Autofac/Container.cs @@ -15,11 +15,11 @@ namespace Bifrost.Autofac { /// - /// Represents an implementation of for AutoFac + /// Represents an implementation of for AutoFac /// public class Container : IContainer { - global::Autofac.IContainer _container; + readonly global::Autofac.IContainer _container; /// /// Initializes a new instance of @@ -30,8 +30,9 @@ public Container(global::Autofac.IContainer container) _container = container; } - #pragma warning disable 1591 + public virtual BindingLifecycle DefaultLifecycle => BindingLifecycle.Transient; + public T Get() { return _container.Resolve(); @@ -45,7 +46,10 @@ public T Get(bool optional) } catch { - if (!optional) throw; + if (!optional) + { + throw; + } } return default(T); @@ -60,11 +64,7 @@ public object Get(Type type) public object Get(Type type, bool optional) { - if (optional) - { - return _container.ResolveOptional(type); - } - return _container.Resolve(type); + return optional ? _container.ResolveOptional(type) : _container.Resolve(type); } public IEnumerable GetAll() @@ -84,22 +84,20 @@ public bool HasBindingFor() public IEnumerable GetAll(Type type) { - List list = ((IEnumerable) _container - .Resolve(typeof (IEnumerable<>) - .MakeGenericType(type))) + return ((IEnumerable)_container.Resolve(typeof(IEnumerable<>).MakeGenericType(type))) .OfType() .ToList(); - - return list; } public IEnumerable GetBoundServices() { - IEnumerable types = _container.ComponentRegistry.Registrations - .SelectMany(r => r.Services.OfType(), - (r, s) => new {r, s}) - .Select(rs => rs.r.Activator.LimitType).ToList(); - return types; + return _container + .ComponentRegistry.Registrations + .SelectMany( + r => r.Services.OfType(), + (r, s) => new { r, s }) + .Select(rs => rs.r.Activator.LimitType) + .ToList(); } public void Bind(Type type, Func resolveCallback) @@ -174,8 +172,6 @@ public void Bind(Type service, Func resolveCallback, BindingLifecy RegisterWithCallback(service, resolveCallback, DefaultLifecycle); } - public BindingLifecycle DefaultLifecycle { get; set; } - #pragma warning restore 1591 void RegisterWithCallback(Type service, Func resolveCallback, BindingLifecycle lifecycle) @@ -228,15 +224,21 @@ object ResolveUnregistered(Type type) foreach (ParameterInfo parameter in parameters) { object service = _container.Resolve(parameter.ParameterType); - if (service == null) throw new Exception("Unkown service"); + if (service == null) + { + throw new Exception("Unkown service"); + } + parameterInstances.Add(service); } + return Activator.CreateInstance(type, parameterInstances.ToArray()); } catch (Exception) { } } + throw new MissingDefaultConstructorException(type); } } diff --git a/Source/Bifrost.Ninject/Container.cs b/Source/Bifrost.Ninject/Container.cs index b9a101d6e..46c67e8e7 100644 --- a/Source/Bifrost.Ninject/Container.cs +++ b/Source/Bifrost.Ninject/Container.cs @@ -21,7 +21,9 @@ public Container(IKernel kernel) _boundServices = new List(); } - public IKernel Kernel { get; private set; } + public virtual BindingLifecycle DefaultLifecycle => BindingLifecycle.Transient; + + public IKernel Kernel { get; } public T Get() { @@ -91,14 +93,12 @@ public void Bind(Func resolveCallback, BindingLifecycle lifecycle) public void Bind(Type type) { - Kernel.Bind().To(type); - _boundServices.Add(typeof(T)); + Bind(type, DefaultLifecycle); } public void Bind(Type service, Type type) { - Kernel.Bind(service).To(type); - _boundServices.Add(service); + Bind(service, type, DefaultLifecycle); } public void Bind(Type type, BindingLifecycle lifecycle) @@ -128,14 +128,12 @@ public void Bind(Type service, object instance) public void Bind(Func resolveCallback) { - Kernel.Bind().ToMethod(c => resolveCallback()); - _boundServices.Add(typeof(T)); + Bind(resolveCallback, DefaultLifecycle); } public void Bind(Type service, Func resolveCallback) { - Kernel.Bind(service).ToMethod(c => resolveCallback(c.Request.Service)); - _boundServices.Add(service); + Bind(service, resolveCallback, DefaultLifecycle); } public void Bind(Func resolveCallback, BindingLifecycle lifecycle) @@ -149,7 +147,5 @@ public void Bind(Type service, Func resolveCallback, BindingLifecy Kernel.Bind(service).ToMethod(c => resolveCallback(c.Request.Service)).WithLifecycle(lifecycle); _boundServices.Add(service); } - - public BindingLifecycle DefaultLifecycle { get; set; } } } diff --git a/Source/Bifrost.SimpleInjector/Container.cs b/Source/Bifrost.SimpleInjector/Container.cs index d9aa9f396..ad9273fa5 100644 --- a/Source/Bifrost.SimpleInjector/Container.cs +++ b/Source/Bifrost.SimpleInjector/Container.cs @@ -3,18 +3,9 @@ * Licensed under the MIT License. See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------*/ using System; +using System.Collections.Generic; using System.Linq; using Bifrost.Execution; -using SimpleInjector; -using SimpleInjector.Extensions; -using SimpleInjector.Extensions.Decorators; -using SimpleInjector.Advanced; -using SimpleInjector.Advanced.Internal; -using SimpleInjector.Diagnostics; -using SimpleInjector.Integration.Web; -using IContainer = Bifrost.Execution.IContainer; -using System; -using System.Collections.Generic; namespace Bifrost.SimpleInjector { @@ -26,7 +17,8 @@ public Container(global::SimpleInjector.Container container) { _container = container; } - public BindingLifecycle DefaultLifecycle { get; set; } + + public virtual BindingLifecycle DefaultLifecycle => BindingLifecycle.Transient; public T Get() { @@ -41,7 +33,10 @@ public T Get(bool optional) } catch { - if (!optional) throw; + if (!optional) + { + throw; + } } return default(T); @@ -52,7 +47,7 @@ public object Get(Type type) return _container.GetInstance(type); } - public object Get(Type type, bool optional = false) + public object Get(Type type, bool optional) { try { @@ -60,7 +55,10 @@ public object Get(Type type, bool optional = false) } catch { - if (!optional) throw; + if (!optional) + { + throw; + } } return null; @@ -95,12 +93,12 @@ public IEnumerable GetBoundServices() public void Bind(Type service, Func resolveCallback) { - _container.Register(service, resolveCallback); + _container.Register(service, resolveCallback, DefaultLifecycle); } public void Bind(Func resolveCallback) { - _container.Register(typeof(T), resolveCallback); + _container.Register(typeof(T), resolveCallback, DefaultLifecycle); } public void Bind(Type service, Func resolveCallback, BindingLifecycle lifecycle) @@ -121,27 +119,27 @@ public void Bind(Func resolveCallback) public void Bind(Type service, Func resolveCallback) { - _container.Register(service, () => resolveCallback(service)); + _container.Register(service, resolveCallback, DefaultLifecycle); } public void Bind(Func resolveCallback, BindingLifecycle lifecycle) { - _container.Register(resolveCallback, lifecycle); + _container.Register(resolveCallback, lifecycle); } public void Bind(Type service, Func resolveCallback, BindingLifecycle lifecycle) { - throw new NotImplementedException(); + _container.Register(service, resolveCallback, lifecycle); } public void Bind(Type type) { - _container.Register(typeof(T), () => type); + _container.Register(typeof(T), () => type, DefaultLifecycle); } public void Bind(Type service, Type type) { - _container.Register(service, () => type); + _container.Register(service, () => type, DefaultLifecycle); } public void Bind(Type type, BindingLifecycle lifecycle) diff --git a/Source/Bifrost.SimpleInjector/ContainerExtensions.cs b/Source/Bifrost.SimpleInjector/ContainerExtensions.cs index b3affc602..834319a5f 100644 --- a/Source/Bifrost.SimpleInjector/ContainerExtensions.cs +++ b/Source/Bifrost.SimpleInjector/ContainerExtensions.cs @@ -17,16 +17,24 @@ public static void Register(this global::SimpleInjector.Container container, Func typeResolver = () => { return resolveCallback.Invoke().GetType(); }; container.Register(typeof(T), typeResolver, lifecycle); } + public static void Register(this global::SimpleInjector.Container container, Func resolveCallback, BindingLifecycle lifecycle) { container.Register(typeof(T), resolveCallback, lifecycle); } + public static void Register(this global::SimpleInjector.Container container, Type service, Func resolveCallback, BindingLifecycle lifecycle) { var lifestyle = ResolveLifestyle(lifecycle); container.Register(service, resolveCallback, lifestyle); } + public static void Register(this global::SimpleInjector.Container container, Type service, Func resolveCallback, BindingLifecycle lifecycle) + { + var lifestyle = ResolveLifestyle(lifecycle); + container.Register(service, () => resolveCallback, lifestyle); + } + private static Lifestyle ResolveLifestyle(BindingLifecycle lifecycle) { var lifestyle = Lifestyle.Transient; diff --git a/Source/Bifrost.StructureMap/Container.cs b/Source/Bifrost.StructureMap/Container.cs index 696a79c62..787e1c986 100644 --- a/Source/Bifrost.StructureMap/Container.cs +++ b/Source/Bifrost.StructureMap/Container.cs @@ -3,156 +3,161 @@ * Licensed under the MIT License. See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------*/ using System; +using System.Collections.Generic; using System.Linq; using Bifrost.Execution; -using System.Collections.Generic; -using InstanceScope = global::StructureMap.InstanceScope; +using StructureMap; +using IContainer = Bifrost.Execution.IContainer; namespace Bifrost.StructureMap { - public class Container : IContainer - { - global::StructureMap.IContainer _container; - - public Container (global::StructureMap.IContainer container) - { - _container = container; - } - - public T Get () - { - return _container.GetInstance(); - } - - public T Get (bool optional) - { - try - { - return _container.GetInstance(); - } - catch - { - if( !optional ) throw; - } - - return default(T); - } - - public object Get (Type type) - { - return _container.GetInstance(type); - } - - public object Get (Type type, bool optional = false) - { - try - { - return _container.GetInstance (type); - } - catch - { - if( !optional ) throw; - } - - return null; - } - - public IEnumerable GetAll () - { - return _container.GetAllInstances(); - } - - public bool HasBindingFor (Type type) - { - return _container.Model.HasImplementationsFor(type); - } - - public bool HasBindingFor () - { - return _container.Model.HasImplementationsFor(); - } - - public IEnumerable GetAll (Type type) - { - var list = new List(); - foreach( var instance in _container.GetAllInstances(type) ) list.Add (instance); - return list; - } - - public IEnumerable GetBoundServices () - { - return _container.Model.PluginTypes.Select(p=>p.PluginType); - } - - public void Bind (Type service, Func resolveCallback) - { - throw new NotImplementedException(); - } - - public void Bind (Func resolveCallback) - { - throw new NotImplementedException (); - } - - public void Bind (Type service, Func resolveCallback, BindingLifecycle lifecycle) - { - throw new NotImplementedException (); - } - - public void Bind (Func resolveCallback, BindingLifecycle lifecycle) - { - throw new NotImplementedException (); - } - - public void Bind (Type type) - { - _container.Configure (c=>c.ForRequestedType().TheDefault.Is.Type (type)); - } - - public void Bind (Type service, Type type) - { - _container.Configure (c=>c.ForRequestedType(service).TheDefaultIsConcreteType(type)); - } - - public void Bind (Type type, BindingLifecycle lifecycle) - { - - _container.Configure (c=>c.ForRequestedType().CacheBy(GetInstanceScopeFor(lifecycle)).TheDefault.Is.Type (type)); - } - - public void Bind (Type service, Type type, BindingLifecycle lifecycle) - { - _container.Configure (c=>c.ForRequestedType(service).CacheBy(GetInstanceScopeFor(lifecycle)).TheDefaultIsConcreteType(type)); - } - - public void Bind (T instance) - { - _container.Configure (c => c.ForRequestedType().Add(instance)); - } - - public void Bind (Type service, object instance) - { - _container.Configure (c => c.ForRequestedType(service).Add (instance)); - } - - - InstanceScope GetInstanceScopeFor(BindingLifecycle lifecycle) - { - switch( lifecycle ) - { - case BindingLifecycle.Transient: - { - return InstanceScope.Transient; - }; - - case BindingLifecycle.Request: return InstanceScope.PerRequest; - case BindingLifecycle.Singleton: return InstanceScope.Singleton; - case BindingLifecycle.Thread: return InstanceScope.ThreadLocal; - } - - return InstanceScope.Transient; - } + public class Container : IContainer + { + readonly global::StructureMap.IContainer _container; + + public Container(global::StructureMap.IContainer container) + { + _container = container; + } + + public virtual BindingLifecycle DefaultLifecycle => BindingLifecycle.Transient; + + public T Get() + { + return _container.GetInstance(); + } + + public T Get(bool optional) + { + try + { + return _container.GetInstance(); + } + catch + { + if (!optional) + { + throw; + } + } + + return default(T); + } + + public object Get(Type type) + { + return _container.GetInstance(type); + } + + public object Get(Type type, bool optional) + { + try + { + return _container.GetInstance(type); + } + catch + { + if (!optional) + { + throw; + } + } + + return null; + } + + public IEnumerable GetAll() + { + return _container.GetAllInstances(); + } + + public bool HasBindingFor(Type type) + { + return _container.Model.HasImplementationsFor(type); + } + + public bool HasBindingFor() + { + return _container.Model.HasImplementationsFor(); + } + + public IEnumerable GetAll(Type type) + { + return _container.GetAllInstances(type).Cast().ToList(); + } + + public IEnumerable GetBoundServices() + { + return _container.Model.PluginTypes.Select(p => p.PluginType); + } + + public void Bind(Type service, Func resolveCallback) + { + throw new NotImplementedException(); + } + + public void Bind(Func resolveCallback) + { + throw new NotImplementedException(); + } + + public void Bind(Type service, Func resolveCallback, BindingLifecycle lifecycle) + { + throw new NotImplementedException(); + } + + public void Bind(Func resolveCallback, BindingLifecycle lifecycle) + { + throw new NotImplementedException(); + } + + public void Bind(Type type) + { + _container.Configure(c => c.ForRequestedType().TheDefault.Is.Type(type)); + } + + public void Bind(Type service, Type type) + { + _container.Configure(c => c.ForRequestedType(service).TheDefaultIsConcreteType(type)); + } + + public void Bind(Type type, BindingLifecycle lifecycle) + { + _container.Configure(c => c.ForRequestedType().CacheBy(GetInstanceScopeFor(lifecycle)).TheDefault.Is.Type(type)); + } + + public void Bind(Type service, Type type, BindingLifecycle lifecycle) + { + _container.Configure(c => c.ForRequestedType(service).CacheBy(GetInstanceScopeFor(lifecycle)).TheDefaultIsConcreteType(type)); + } + + public void Bind(T instance) + { + _container.Configure(c => c.ForRequestedType().Add(instance)); + } + public void Bind(Type service, object instance) + { + _container.Configure(c => c.ForRequestedType(service).Add(instance)); + } + + + InstanceScope GetInstanceScopeFor(BindingLifecycle lifecycle) + { + switch (lifecycle) + { + case BindingLifecycle.Transient: + return InstanceScope.Transient; + case BindingLifecycle.Request: + return InstanceScope.PerRequest; + case BindingLifecycle.Singleton: + return InstanceScope.Singleton; + case BindingLifecycle.Thread: + return InstanceScope.ThreadLocal; + default: + return InstanceScope.Transient; + } + } public void Bind(Func resolveCallback) { @@ -173,8 +178,5 @@ public void Bind(Type service, Func resolveCallback, BindingLifecy { throw new NotImplementedException(); } - - public BindingLifecycle DefaultLifecycle { get; set; } } } - diff --git a/Source/Bifrost/Configuration/Configure.cs b/Source/Bifrost/Configuration/Configure.cs index 6028f45d5..b6f26e28e 100644 --- a/Source/Bifrost/Configuration/Configure.cs +++ b/Source/Bifrost/Configuration/Configure.cs @@ -28,14 +28,14 @@ public class Configure : IConfigure /// public static Configure Instance { get; private set; } - - Configure(IContainer container, BindingLifecycle defaultLifecycle, IDefaultConventions defaultConventions, IDefaultBindings defaultBindings, AssembliesConfiguration assembliesConfiguration) + Configure( + IContainer container, + IDefaultConventions defaultConventions, + IDefaultBindings defaultBindings, + AssembliesConfiguration assembliesConfiguration) { SystemName = "[Not Set]"; - AssembliesConfiguration = assembliesConfiguration; - - container.DefaultLifecycle = defaultLifecycle; container.Bind(this); Container = container; @@ -88,37 +88,36 @@ public static Configure DiscoverAndConfigure(Action - /// Configure with a specific and the Lifecycle of objects set to none + /// Configure with a specific . /// - /// to configure with - /// to use - /// to use for providing assemblies - /// for keeping track of the relationship between contracts and implementors - /// Configuration object to continue configuration on - public static Configure With(IContainer container, AssembliesConfiguration assembliesConfiguration, IAssemblyProvider assemblyProvider, IContractToImplementorsMap contractToImplementorsMap) + /// to configure with. + /// to use. + /// to use for providing assemblies. + /// for keeping track of + /// the relationship between contracts and implementors. + /// Configuration object to continue configuration on. + public static Configure With( + IContainer container, + AssembliesConfiguration assembliesConfiguration, + IAssemblyProvider assemblyProvider, + IContractToImplementorsMap contractToImplementorsMap) { - return With(container, BindingLifecycle.Transient, assembliesConfiguration, assemblyProvider, contractToImplementorsMap); - } - - /// - /// Configure with a specific - /// - /// to configure with - /// Default for object creation/management - /// to use - /// to use for providing assemblies - /// for keeping track of the relationship between contracts and implementors - /// Configuration object to continue configuration on - public static Configure With(IContainer container, BindingLifecycle defaultObjectLifecycle, AssembliesConfiguration assembliesConfiguration, IAssemblyProvider assemblyProvider, IContractToImplementorsMap contractToImplementorsMap) - { - return With(container, defaultObjectLifecycle, new DefaultConventions(container), new DefaultBindings(assembliesConfiguration, assemblyProvider, contractToImplementorsMap), assembliesConfiguration); + return With( + container, + new DefaultConventions(container), + new DefaultBindings(assembliesConfiguration, assemblyProvider, contractToImplementorsMap), + assembliesConfiguration); } /// @@ -129,7 +128,6 @@ public static void Reset() lock (InstanceLock) Instance = null; } - /// /// Configure with a specific , and /// @@ -138,28 +136,17 @@ public static void Reset() /// to use /// to use /// - public static Configure With(IContainer container, IDefaultConventions defaultConventions, IDefaultBindings defaultBindings, AssembliesConfiguration assembliesConfiguration) - { - return With(container, BindingLifecycle.Transient, defaultConventions, defaultBindings, assembliesConfiguration); - } - - - /// - /// Configure with a specific , and - /// - /// to configure with - /// Default for object creation/management - /// to use - /// to use - /// to use - /// - public static Configure With(IContainer container, BindingLifecycle defaultObjectLifecycle, IDefaultConventions defaultConventions, IDefaultBindings defaultBindings, AssembliesConfiguration assembliesConfiguration) + public static Configure With( + IContainer container, + IDefaultConventions defaultConventions, + IDefaultBindings defaultBindings, + AssembliesConfiguration assembliesConfiguration) { if (Instance == null) { lock (InstanceLock) { - Instance = new Configure(container, defaultObjectLifecycle, defaultConventions, defaultBindings, assembliesConfiguration); + Instance = new Configure(container, defaultConventions, defaultBindings, assembliesConfiguration); } } @@ -188,12 +175,6 @@ public static Configure With(IContainer container, BindingLifecycle defaultObjec public CultureInfo Culture { get; set; } public CultureInfo UICulture { get; set; } - public BindingLifecycle DefaultLifecycle - { - get { return Container.DefaultLifecycle; } - set { Container.DefaultLifecycle = value; } - } - public void Initialize() { ConfigureFromCanConfigurables(); diff --git a/Source/Bifrost/Configuration/ExecutionContextConfiguration.cs b/Source/Bifrost/Configuration/ExecutionContextConfiguration.cs index e34aeed13..266f703fb 100644 --- a/Source/Bifrost/Configuration/ExecutionContextConfiguration.cs +++ b/Source/Bifrost/Configuration/ExecutionContextConfiguration.cs @@ -14,7 +14,7 @@ public class ExecutionContextConfiguration : IExecutionContextConfiguration #pragma warning disable 1591 // Xml Comments public void Initialize(IContainer container) { - container.Bind(() => container.Get().Current, container.DefaultLifecycle); + container.Bind(() => container.Get().Current); } #pragma warning restore 1591 // Xml Comments } diff --git a/Source/Bifrost/Configuration/IConfigure.cs b/Source/Bifrost/Configuration/IConfigure.cs index 951f6ddfc..2e0fad1f6 100644 --- a/Source/Bifrost/Configuration/IConfigure.cs +++ b/Source/Bifrost/Configuration/IConfigure.cs @@ -9,15 +9,15 @@ namespace Bifrost.Configuration { - /// - /// Defines the configuration for Bifrost - /// - public interface IConfigure - { - /// - /// Gets the container that is used - /// - IContainer Container { get; } + /// + /// Defines the configuration for Bifrost + /// + public interface IConfigure + { + /// + /// Gets the container that is used + /// + IContainer Container { get; } /// /// Gets or sets the name of the currently running system @@ -29,16 +29,16 @@ public interface IConfigure /// Assembly EntryAssembly { get; } - /// - /// Gets the configuration for commands - /// - ICommandsConfiguration Commands { get; } + /// + /// Gets the configuration for commands + /// + ICommandsConfiguration Commands { get; } - /// - /// Gets the configuration for events. + /// + /// Gets the configuration for events. /// Supports specific storage - /// - IEventsConfiguration Events { get; } + /// + IEventsConfiguration Events { get; } /// /// Gets the configuration for Tasks @@ -46,21 +46,21 @@ public interface IConfigure /// ITasksConfiguration Tasks { get; } - /// - /// Gets the configuration for views - /// - IViewsConfiguration Views { get; } + /// + /// Gets the configuration for views + /// + IViewsConfiguration Views { get; } - /// - /// Gets the convention manager for bindings - /// - IBindingConventionManager ConventionManager { get; } + /// + /// Gets the convention manager for bindings + /// + IBindingConventionManager ConventionManager { get; } - /// - /// Gets the configuration for sagas + /// + /// Gets the configuration for sagas /// Supports specific storage - /// - ISagasConfiguration Sagas { get; } + /// + ISagasConfiguration Sagas { get; } /// /// Gets the configureation for serialization @@ -96,25 +96,20 @@ public interface IConfigure /// Gets the configuration for assemblies and how they are treated /// AssembliesConfiguration Assemblies { get; } - - /// - /// Gets or sets the culture to use in Bifrost - /// - CultureInfo Culture { get; set; } - /// - /// Gets or sets the UI culture to use in Bifrost - /// - CultureInfo UICulture { get; set; } + /// + /// Gets or sets the culture to use in Bifrost + /// + CultureInfo Culture { get; set; } /// - /// Gets or sets the default for objects when created/managed by the + /// Gets or sets the UI culture to use in Bifrost /// - BindingLifecycle DefaultLifecycle { get; set; } + CultureInfo UICulture { get; set; } - /// - /// Initializes Bifrost after configuration - /// - void Initialize(); - } + /// + /// Initializes Bifrost after configuration + /// + void Initialize(); + } } \ No newline at end of file diff --git a/Source/Bifrost/Execution/IContainer.cs b/Source/Bifrost/Execution/IContainer.cs index 70b0dc393..f812fecea 100644 --- a/Source/Bifrost/Execution/IContainer.cs +++ b/Source/Bifrost/Execution/IContainer.cs @@ -12,13 +12,6 @@ namespace Bifrost.Execution /// public interface IContainer { - /// - /// Gets or sets the for objects. - /// This property usually guides the implementing container for default bindings it may create for types that - /// does not have an explicit binding and is not abstract or an interface - /// - BindingLifecycle DefaultLifecycle { get; set; } - /// /// Get an instance of a specific type /// @@ -47,7 +40,7 @@ public interface IContainer /// Type to get instance of /// If the binding is optional, return null and not throw an exception /// Instance of the type - object Get(Type type, bool optional = false); + object Get(Type type, bool optional); /// /// Get all instances of a specific type