Skip to content

Commit

Permalink
Merge branch 'master' into bait-switch
Browse files Browse the repository at this point in the history
  • Loading branch information
Oren Novotny committed Jun 5, 2015
2 parents cd25c79 + e94cbae commit 2bdbd4c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/Ninject/Activation/Caching/ActivationCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class ActivationCache : NinjectComponent, IActivationCache, IPruneable
/// <param name="cachePruner">The cache pruner.</param>
public ActivationCache(ICachePruner cachePruner)
{
Ensure.ArgumentNotNull(cachePruner, "cachePruner");
cachePruner.Start(this);
}

Expand Down
3 changes: 3 additions & 0 deletions src/Ninject/Activation/Pipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class Pipeline : NinjectComponent, IPipeline
public Pipeline(IEnumerable<IActivationStrategy> strategies, IActivationCache activationCache)
{
Ensure.ArgumentNotNull(strategies, "strategies");
Ensure.ArgumentNotNull(activationCache, "activationCache");
this.Strategies = strategies.ToList();
this.activationCache = activationCache;
}
Expand All @@ -53,6 +54,7 @@ public Pipeline(IEnumerable<IActivationStrategy> strategies, IActivationCache ac
public void Activate(IContext context, InstanceReference reference)
{
Ensure.ArgumentNotNull(context, "context");
Ensure.ArgumentNotNull(reference, "reference");
if (!this.activationCache.IsActivated(reference.Instance))
{
this.Strategies.Map(s => s.Activate(context, reference));
Expand All @@ -67,6 +69,7 @@ public void Activate(IContext context, InstanceReference reference)
public void Deactivate(IContext context, InstanceReference reference)
{
Ensure.ArgumentNotNull(context, "context");
Ensure.ArgumentNotNull(reference, "reference");
if (!this.activationCache.IsDeactivated(reference.Instance))
{
this.Strategies.Map(s => s.Deactivate(context, reference));
Expand Down
2 changes: 2 additions & 0 deletions src/Ninject/Activation/Strategies/ActivationCacheStrategy.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Ninject.Activation.Strategies
{
using Ninject.Activation.Caching;
using Ninject.Infrastructure;

/// <summary>
/// Adds all activated instances to the activation cache.
Expand All @@ -18,6 +19,7 @@ public class ActivationCacheStrategy : IActivationStrategy
/// <param name="activationCache">The activation cache.</param>
public ActivationCacheStrategy(IActivationCache activationCache)
{
Ensure.ArgumentNotNull(activationCache, "activationCache");
this.activationCache = activationCache;
}

Expand Down
1 change: 1 addition & 0 deletions src/Ninject/Modules/CompiledModuleLoaderPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class CompiledModuleLoaderPlugin : NinjectComponent, IModuleLoaderPlugin
public CompiledModuleLoaderPlugin(IKernel kernel, IAssemblyNameRetriever assemblyNameRetriever)
{
Ensure.ArgumentNotNull(kernel, "kernel");
Ensure.ArgumentNotNull(assemblyNameRetriever, "assemblyNameRetriever");
this.Kernel = kernel;
this.assemblyNameRetriever = assemblyNameRetriever;
}
Expand Down
18 changes: 9 additions & 9 deletions src/Ninject/Syntax/ResolutionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public static IEnumerable<object> GetAll(this IResolutionRoot root, Type service
/// <typeparam name="T">The service to resolve.</typeparam>
/// <param name="root">The resolution root.</param>
/// <param name="parameters">The parameters to pass to the request.</param>
/// <returns>An instance of the service.</returns>
/// <returns><c>True</c> if the request can be resolved; otherwise, <c>false</c>.</returns>
public static bool CanResolve<T>(this IResolutionRoot root, params IParameter[] parameters)
{
return CanResolve(root, typeof(T), null, parameters, false, true);
Expand All @@ -310,7 +310,7 @@ public static bool CanResolve<T>(this IResolutionRoot root, params IParameter[]
/// <param name="root">The resolution root.</param>
/// <param name="name">The name of the binding.</param>
/// <param name="parameters">The parameters to pass to the request.</param>
/// <returns>An instance of the service.</returns>
/// <returns><c>True</c> if the request can be resolved; otherwise, <c>false</c>.</returns>
public static bool CanResolve<T>(this IResolutionRoot root, string name, params IParameter[] parameters)
{
return CanResolve(root, typeof(T), b => b.Name == name, parameters, false, true);
Expand All @@ -323,7 +323,7 @@ public static bool CanResolve<T>(this IResolutionRoot root, string name, params
/// <param name="root">The resolution root.</param>
/// <param name="constraint">The constraint to apply to the binding.</param>
/// <param name="parameters">The parameters to pass to the request.</param>
/// <returns>An instance of the service.</returns>
/// <returns><c>True</c> if the request can be resolved; otherwise, <c>false</c>.</returns>
public static bool CanResolve<T>(this IResolutionRoot root, Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
{
return CanResolve(root, typeof(T), constraint, parameters, false, true);
Expand All @@ -335,8 +335,8 @@ public static bool CanResolve<T>(this IResolutionRoot root, Func<IBindingMetadat
/// <param name="root">The resolution root.</param>
/// <param name="service">The service to resolve.</param>
/// <param name="parameters">The parameters to pass to the request.</param>
/// <returns>An instance of the service.</returns>
public static object CanResolve(this IResolutionRoot root, Type service, params IParameter[] parameters)
/// <returns><c>True</c> if the request can be resolved; otherwise, <c>false</c>.</returns>
public static bool CanResolve(this IResolutionRoot root, Type service, params IParameter[] parameters)
{
return CanResolve(root, service, null, parameters, false, true);
}
Expand All @@ -348,8 +348,8 @@ public static object CanResolve(this IResolutionRoot root, Type service, params
/// <param name="service">The service to resolve.</param>
/// <param name="name">The name of the binding.</param>
/// <param name="parameters">The parameters to pass to the request.</param>
/// <returns>An instance of the service.</returns>
public static object CanResolve(this IResolutionRoot root, Type service, string name, params IParameter[] parameters)
/// <returns><c>True</c> if the request can be resolved; otherwise, <c>false</c>.</returns>
public static bool CanResolve(this IResolutionRoot root, Type service, string name, params IParameter[] parameters)
{
return CanResolve(root, service, b => b.Name == name, parameters, false, true);
}
Expand All @@ -361,8 +361,8 @@ public static object CanResolve(this IResolutionRoot root, Type service, string
/// <param name="service">The service to resolve.</param>
/// <param name="constraint">The constraint to apply to the binding.</param>
/// <param name="parameters">The parameters to pass to the request.</param>
/// <returns>An instance of the service.</returns>
public static object CanResolve(this IResolutionRoot root, Type service, Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
/// <returns><c>True</c> if the request can be resolved; otherwise, <c>false</c>.</returns>
public static bool CanResolve(this IResolutionRoot root, Type service, Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
{
return CanResolve(root, service, constraint, parameters, false, true);
}
Expand Down

0 comments on commit 2bdbd4c

Please sign in to comment.