Author: nkohari
Date: Sun Feb 15 19:47:14 2009
New Revision: 144
Added:
experiments/ninject2/src/Ninject/Injection/Linq/ExpressionHelper.cs
- copied, changed from r143,
/experiments/ninject2/src/Ninject/Injection/Linq/MethodInjectionExpressionHelper.cs
Removed:
experiments/ninject2/src/Ninject/Injection/Linq/MethodInjectionExpressionHelper.cs
Modified:
experiments/ninject2/src/Ninject.Tests/Unit/ActivationScopeTests.cs
experiments/ninject2/src/Ninject/Activation/Caching/Cache.cs
experiments/ninject2/src/Ninject/Activation/Caching/CachePruner.cs
experiments/ninject2/src/Ninject/Activation/Caching/ICache.cs
experiments/ninject2/src/Ninject/Activation/Caching/ICachePruner.cs
experiments/ninject2/src/Ninject/Activation/Context.cs
experiments/ninject2/src/Ninject/Activation/Hooks/ConstantHook.cs
experiments/ninject2/src/Ninject/Activation/Hooks/ContextResolutionHook.cs
experiments/ninject2/src/Ninject/Activation/Hooks/IHook.cs
experiments/ninject2/src/Ninject/Activation/IContext.cs
experiments/ninject2/src/Ninject/Activation/IPipeline.cs
experiments/ninject2/src/Ninject/Activation/IProvider.cs
experiments/ninject2/src/Ninject/Activation/IRequest.cs
experiments/ninject2/src/Ninject/Activation/Pipeline.cs
experiments/ninject2/src/Ninject/Activation/Provider.cs
experiments/ninject2/src/Ninject/Activation/Providers/CallbackProvider.cs
experiments/ninject2/src/Ninject/Activation/Providers/ConstantProvider.cs
experiments/ninject2/src/Ninject/Activation/Providers/StandardProvider.cs
experiments/ninject2/src/Ninject/Activation/Request.cs
experiments/ninject2/src/Ninject/Activation/Scope/ActivationScope.cs
experiments/ninject2/src/Ninject/Activation/Scope/IActivationScope.cs
experiments/ninject2/src/Ninject/Activation/Strategies/ActivationStrategy.cs
experiments/ninject2/src/Ninject/Activation/Strategies/ActivationStrategyFor.cs
experiments/ninject2/src/Ninject/Activation/Strategies/BindingActionStrategy.cs
experiments/ninject2/src/Ninject/Activation/Strategies/DisposableStrategy.cs
experiments/ninject2/src/Ninject/Activation/Strategies/IActivationStrategy.cs
experiments/ninject2/src/Ninject/Activation/Strategies/InitializableStrategy.cs
experiments/ninject2/src/Ninject/Activation/Strategies/MethodInjectionStrategy.cs
experiments/ninject2/src/Ninject/Activation/Strategies/PropertyInjectionStrategy.cs
experiments/ninject2/src/Ninject/Activation/Strategies/StartableStrategy.cs
experiments/ninject2/src/Ninject/ActivationException.cs
experiments/ninject2/src/Ninject/Attributes/ConstraintAttribute.cs
experiments/ninject2/src/Ninject/Attributes/InjectAttribute.cs
experiments/ninject2/src/Ninject/Attributes/NamedAttribute.cs
experiments/ninject2/src/Ninject/Components/ComponentContainer.cs
experiments/ninject2/src/Ninject/Components/IComponentContainer.cs
experiments/ninject2/src/Ninject/Components/INinjectComponent.cs
experiments/ninject2/src/Ninject/Components/NinjectComponent.cs
experiments/ninject2/src/Ninject/Events/BindingEventArgs.cs
experiments/ninject2/src/Ninject/Events/ModuleEventArgs.cs
experiments/ninject2/src/Ninject/IInitializable.cs
experiments/ninject2/src/Ninject/IKernel.cs
experiments/ninject2/src/Ninject/INinjectSettings.cs
experiments/ninject2/src/Ninject/IStartable.cs
experiments/ninject2/src/Ninject/Infrastructure/Disposal/DisposableObject.cs
experiments/ninject2/src/Ninject/Infrastructure/Disposal/INotifyWhenDisposed.cs
experiments/ninject2/src/Ninject/Infrastructure/IHaveKernel.cs
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForEventHandler.cs
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForICollection.cs
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForICustomAttributeProvider.cs
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForIDictionary.cs
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForIEnumerable.cs
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForIList.cs
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForTargetInvocationException.cs
experiments/ninject2/src/Ninject/Infrastructure/LinqReflection.cs
experiments/ninject2/src/Ninject/Infrastructure/Multimap.cs
experiments/ninject2/src/Ninject/Infrastructure/Tracing/IHaveTraceInfo.cs
experiments/ninject2/src/Ninject/Infrastructure/Tracing/TraceInfo.cs
experiments/ninject2/src/Ninject/Infrastructure/Tracing/TraceInfoProvider.cs
experiments/ninject2/src/Ninject/Injection/IConstructorInjector.cs
experiments/ninject2/src/Ninject/Injection/IInjectorFactory.cs
experiments/ninject2/src/Ninject/Injection/IMethodInjector.cs
experiments/ninject2/src/Ninject/Injection/IPropertyInjector.cs
experiments/ninject2/src/Ninject/Injection/Linq/ConstructorInjector.cs
experiments/ninject2/src/Ninject/Injection/Linq/ExpressionBasedInjector.cs
experiments/ninject2/src/Ninject/Injection/Linq/InjectorFactory.cs
experiments/ninject2/src/Ninject/Injection/Linq/MethodInjector.cs
experiments/ninject2/src/Ninject/Injection/Linq/MethodInjectorBase.cs
experiments/ninject2/src/Ninject/Injection/Linq/PropertyInjector.cs
experiments/ninject2/src/Ninject/Injection/Linq/VoidMethodInjector.cs
experiments/ninject2/src/Ninject/KernelBase.cs
experiments/ninject2/src/Ninject/Modules/IModule.cs
experiments/ninject2/src/Ninject/Modules/IModuleLoader.cs
experiments/ninject2/src/Ninject/Modules/Module.cs
experiments/ninject2/src/Ninject/Modules/ModuleLoader.cs
experiments/ninject2/src/Ninject/Ninject.csproj
experiments/ninject2/src/Ninject/NinjectSettings.cs
experiments/ninject2/src/Ninject/Parameters/ConstructorArgument.cs
experiments/ninject2/src/Ninject/Parameters/IParameter.cs
experiments/ninject2/src/Ninject/Parameters/Parameter.cs
experiments/ninject2/src/Ninject/Parameters/PropertyValue.cs
experiments/ninject2/src/Ninject/Planning/Bindings/Binding.cs
experiments/ninject2/src/Ninject/Planning/Bindings/BindingBuilder.cs
experiments/ninject2/src/Ninject/Planning/Bindings/BindingMetadata.cs
experiments/ninject2/src/Ninject/Planning/Bindings/IBinding.cs
experiments/ninject2/src/Ninject/Planning/Bindings/IBindingMetadata.cs
experiments/ninject2/src/Ninject/Planning/Directives/ConstructorInjectionDirective.cs
experiments/ninject2/src/Ninject/Planning/Directives/IDirective.cs
experiments/ninject2/src/Ninject/Planning/Directives/MethodInjectionDirective.cs
experiments/ninject2/src/Ninject/Planning/Directives/MethodInjectionDirectiveBase.cs
experiments/ninject2/src/Ninject/Planning/Directives/PropertyInjectionDirective.cs
experiments/ninject2/src/Ninject/Planning/IPlan.cs
experiments/ninject2/src/Ninject/Planning/IPlanner.cs
experiments/ninject2/src/Ninject/Planning/Plan.cs
experiments/ninject2/src/Ninject/Planning/Planner.cs
experiments/ninject2/src/Ninject/Planning/Strategies/ConstructorReflectionStrategy.cs
experiments/ninject2/src/Ninject/Planning/Strategies/IPlanningStrategy.cs
experiments/ninject2/src/Ninject/Planning/Strategies/MethodReflectionStrategy.cs
experiments/ninject2/src/Ninject/Planning/Strategies/PropertyReflectionStrategy.cs
experiments/ninject2/src/Ninject/Planning/Targets/ITarget.cs
experiments/ninject2/src/Ninject/Planning/Targets/ParameterTarget.cs
experiments/ninject2/src/Ninject/Planning/Targets/PropertyTarget.cs
experiments/ninject2/src/Ninject/Planning/Targets/Target.cs
experiments/ninject2/src/Ninject/Properties/AssemblyInfo.cs
experiments/ninject2/src/Ninject/Selection/Heuristics/IConstructorScorer.cs
experiments/ninject2/src/Ninject/Selection/Heuristics/IMethodInjectionHeuristic.cs
experiments/ninject2/src/Ninject/Selection/Heuristics/IPropertyInjectionHeuristic.cs
experiments/ninject2/src/Ninject/Selection/Heuristics/StandardConstructorScorer.cs
experiments/ninject2/src/Ninject/Selection/Heuristics/StandardMethodInjectionHeuristic.cs
experiments/ninject2/src/Ninject/Selection/Heuristics/StandardPropertyInjectionHeuristic.cs
experiments/ninject2/src/Ninject/Selection/ISelector.cs
experiments/ninject2/src/Ninject/Selection/Selector.cs
experiments/ninject2/src/Ninject/StandardKernel.cs
experiments/ninject2/src/Ninject/Syntax/BindingSyntax.cs
experiments/ninject2/src/Ninject/Syntax/IBindingRoot.cs
experiments/ninject2/src/Ninject/Syntax/IFluentSyntax.cs
experiments/ninject2/src/Ninject/Syntax/IResolutionRoot.cs
experiments/ninject2/src/Ninject/Syntax/ModuleLoadExtensions.cs
experiments/ninject2/src/Ninject/Syntax/ResolutionExtensions.cs
Log:
Modified:
experiments/ninject2/src/Ninject.Tests/Unit/ActivationScopeTests.cs
==============================================================================
--- experiments/ninject2/src/Ninject.Tests/Unit/ActivationScopeTests.cs
(original)
+++ experiments/ninject2/src/Ninject.Tests/Unit/ActivationScopeTests.cs Sun
Feb 15 19:47:14 2009
@@ -51,14 +51,14 @@
[Fact]
public void ScopeCreatesRequestAndDelegatesCallToParent()
{
- scope.Resolve(typeof(IWeapon), new Func<IBindingMetadata, bool>[0], new
IParameter[0]);
- parentMock.Verify(x => x.Resolve(It.Is<Request>(r => r.Service ==
typeof(IWeapon) && r.Constraints.Count == 0 && r.Parameters.Count == 0)));
+ scope.Resolve(typeof(IWeapon), null, new IParameter[0]);
+ parentMock.Verify(x => x.Resolve(It.Is<Request>(r => r.Service ==
typeof(IWeapon) && r.Constraint == null && r.Parameters.Count == 0)));
}
[Fact]
public void ScopeCreatesRequestWithItselfAsScope()
{
- scope.Resolve(typeof(IWeapon), new Func<IBindingMetadata, bool>[0], new
IParameter[0]);
+ scope.Resolve(typeof(IWeapon), null, new IParameter[0]);
parentMock.Verify(x => x.Resolve(It.Is<Request>(r =>
ReferenceEquals(r.ScopeCallback(), scope))));
}
}
Modified: experiments/ninject2/src/Ninject/Activation/Caching/Cache.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/Caching/Cache.cs (original)
+++ experiments/ninject2/src/Ninject/Activation/Caching/Cache.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Activation/Caching/CachePruner.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/Caching/CachePruner.cs
(original)
+++ experiments/ninject2/src/Ninject/Activation/Caching/CachePruner.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Activation/Caching/ICache.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/Caching/ICache.cs (original)
+++ experiments/ninject2/src/Ninject/Activation/Caching/ICache.cs Sun Feb
15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Caching/ICachePruner.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/Caching/ICachePruner.cs
(original)
+++ experiments/ninject2/src/Ninject/Activation/Caching/ICachePruner.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Activation/Context.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/Context.cs (original)
+++ experiments/ninject2/src/Ninject/Activation/Context.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Activation/Hooks/ConstantHook.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/Hooks/ConstantHook.cs
(original)
+++ experiments/ninject2/src/Ninject/Activation/Hooks/ConstantHook.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Hooks/ContextResolutionHook.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Activation/Hooks/ContextResolutionHook.cs
(original)
+++
experiments/ninject2/src/Ninject/Activation/Hooks/ContextResolutionHook.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Activation/Hooks/IHook.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/Hooks/IHook.cs (original)
+++ experiments/ninject2/src/Ninject/Activation/Hooks/IHook.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Activation/IContext.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/IContext.cs (original)
+++ experiments/ninject2/src/Ninject/Activation/IContext.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Activation/IPipeline.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/IPipeline.cs (original)
+++ experiments/ninject2/src/Ninject/Activation/IPipeline.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Activation/IProvider.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/IProvider.cs (original)
+++ experiments/ninject2/src/Ninject/Activation/IProvider.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Activation/IRequest.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/IRequest.cs (original)
+++ experiments/ninject2/src/Ninject/Activation/IRequest.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -45,9 +45,9 @@
ITarget Target { get; }
/// <summary>
- /// Gets the constraints that will be applied to filter the bindings
used for the request.
+ /// Gets the constraint that will be applied to filter the bindings used
for the request.
/// </summary>
- ICollection<Func<IBindingMetadata, bool>> Constraints { get; }
+ Func<IBindingMetadata, bool> Constraint { get; }
/// <summary>
/// Gets the parameters that affect the resolution.
@@ -55,11 +55,11 @@
ICollection<IParameter> Parameters { get; }
/// <summary>
- /// Determines whether the specified binding satisfies the constraints
defined on this request.
+ /// Determines whether the specified binding satisfies the constraint
defined on this request.
/// </summary>
/// <param name="binding">The binding.</param>
- /// <returns><c>True</c> if the binding satisfies the constraints;
otherwise <c>false</c>.</returns>
- bool ConstraintsSatisfiedBy(IBinding binding);
+ /// <returns><c>True</c> if the binding satisfies the constraint;
otherwise <c>false</c>.</returns>
+ bool Matches(IBinding binding);
/// <summary>
/// Gets the scope if one was specified in the request.
Modified: experiments/ninject2/src/Ninject/Activation/Pipeline.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/Pipeline.cs (original)
+++ experiments/ninject2/src/Ninject/Activation/Pipeline.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Activation/Provider.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/Provider.cs (original)
+++ experiments/ninject2/src/Ninject/Activation/Provider.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Providers/CallbackProvider.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Activation/Providers/CallbackProvider.cs
(original)
+++
experiments/ninject2/src/Ninject/Activation/Providers/CallbackProvider.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Providers/ConstantProvider.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Activation/Providers/ConstantProvider.cs
(original)
+++
experiments/ninject2/src/Ninject/Activation/Providers/ConstantProvider.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Providers/StandardProvider.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Activation/Providers/StandardProvider.cs
(original)
+++
experiments/ninject2/src/Ninject/Activation/Providers/StandardProvider.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Activation/Request.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/Request.cs (original)
+++ experiments/ninject2/src/Ninject/Activation/Request.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -48,7 +48,7 @@
/// <summary>
/// Gets the constraints that will be applied to filter the bindings
used for the request.
/// </summary>
- public ICollection<Func<IBindingMetadata, bool>> Constraints { get; set;
}
+ public Func<IBindingMetadata, bool> Constraint { get; set; }
/// <summary>
/// Gets the parameters that affect the resolution.
@@ -64,13 +64,13 @@
/// Initializes a new instance of the <see cref="Request"/> class.
/// </summary>
/// <param name="service">The service that was requested.</param>
- /// <param name="constraints">The constraints that will be applied to
filter the bindings used for the request.</param>
+ /// <param name="constraint">The constraint that will be applied to
filter the bindings used for the request.</param>
/// <param name="parameters">The parameters that affect the
resolution.</param>
/// <param name="scopeCallback">The scope callback, if an external scope
was specified.</param>
- public Request(Type service, IEnumerable<Func<IBindingMetadata, bool>>
constraints, IEnumerable<IParameter> parameters, Func<object> scopeCallback)
+ public Request(Type service, Func<IBindingMetadata, bool> constraint,
IEnumerable<IParameter> parameters, Func<object> scopeCallback)
{
Service = service;
- Constraints = constraints == null ? new List<Func<IBindingMetadata,
bool>>() : constraints.ToList();
+ Constraint = constraint;
Parameters = parameters == null ? new List<IParameter>() :
parameters.ToList();
ScopeCallback = scopeCallback;
}
@@ -87,7 +87,7 @@
Parent = parent;
Service = service;
Target = target;
- Constraints = target.GetConstraints().ToList();
+ Constraint = target.Constraint;
Parameters = new List<IParameter>();
ScopeCallback = scopeCallback;
}
@@ -97,9 +97,9 @@
/// </summary>
/// <param name="binding">The binding.</param>
/// <returns><c>True</c> if the binding satisfies the constraints;
otherwise <c>false</c>.</returns>
- public bool ConstraintsSatisfiedBy(IBinding binding)
+ public bool Matches(IBinding binding)
{
- return Constraints.All(constraint => constraint(binding.Metadata));
+ return Constraint == null || Constraint(binding.Metadata);
}
/// <summary>
Modified:
experiments/ninject2/src/Ninject/Activation/Scope/ActivationScope.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/Scope/ActivationScope.cs
(original)
+++ experiments/ninject2/src/Ninject/Activation/Scope/ActivationScope.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -60,12 +60,12 @@
/// Resolves the specified request.
/// </summary>
/// <param name="service">The service to resolve.</param>
- /// <param name="constraints">The constraints to apply to the bindings
to determine if they match the request.</param>
+ /// <param name="constraint">The constraint to apply to the bindings to
determine if they match the request.</param>
/// <param name="parameters">The parameters to pass to the
resolution.</param>
/// <returns>A series of hooks that can be used to resolve instances
that match the request.</returns>
- public IEnumerable<IHook> Resolve(Type service,
IEnumerable<Func<IBindingMetadata, bool>> constraints,
IEnumerable<IParameter> parameters)
+ public IEnumerable<IHook> Resolve(Type service, Func<IBindingMetadata,
bool> constraint, IEnumerable<IParameter> parameters)
{
- return Resolve(CreateDirectRequest(service, constraints, parameters));
+ return Resolve(CreateDirectRequest(service, constraint, parameters));
}
/// <summary>
@@ -82,12 +82,12 @@
/// Creates a request for the specified service.
/// </summary>
/// <param name="service">The service to resolve.</param>
- /// <param name="constraints">The constraints to apply to the bindings
to determine if they match the request.</param>
+ /// <param name="constraint">The constraints to apply to the bindings to
determine if they match the request.</param>
/// <param name="parameters">The parameters to pass to the
resolution.</param>
/// <returns>The created request.</returns>
- protected virtual IRequest CreateDirectRequest(Type service,
IEnumerable<Func<IBindingMetadata, bool>> constraints,
IEnumerable<IParameter> parameters)
+ protected virtual IRequest CreateDirectRequest(Type service,
Func<IBindingMetadata, bool> constraint, IEnumerable<IParameter> parameters)
{
- return new Request(service, constraints, parameters, () => this);
+ return new Request(service, constraint, parameters, () => this);
}
object IServiceProvider.GetService(Type serviceType)
Modified:
experiments/ninject2/src/Ninject/Activation/Scope/IActivationScope.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/Scope/IActivationScope.cs
(original)
+++ experiments/ninject2/src/Ninject/Activation/Scope/IActivationScope.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Strategies/ActivationStrategy.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Activation/Strategies/ActivationStrategy.cs
(original)
+++
experiments/ninject2/src/Ninject/Activation/Strategies/ActivationStrategy.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Strategies/ActivationStrategyFor.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Activation/Strategies/ActivationStrategyFor.cs
(original)
+++
experiments/ninject2/src/Ninject/Activation/Strategies/ActivationStrategyFor.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Strategies/BindingActionStrategy.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Activation/Strategies/BindingActionStrategy.cs
(original)
+++
experiments/ninject2/src/Ninject/Activation/Strategies/BindingActionStrategy.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Strategies/DisposableStrategy.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Activation/Strategies/DisposableStrategy.cs
(original)
+++
experiments/ninject2/src/Ninject/Activation/Strategies/DisposableStrategy.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Strategies/IActivationStrategy.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Activation/Strategies/IActivationStrategy.cs
(original)
+++
experiments/ninject2/src/Ninject/Activation/Strategies/IActivationStrategy.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Strategies/InitializableStrategy.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Activation/Strategies/InitializableStrategy.cs
(original)
+++
experiments/ninject2/src/Ninject/Activation/Strategies/InitializableStrategy.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Strategies/MethodInjectionStrategy.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Activation/Strategies/MethodInjectionStrategy.cs
(original)
+++
experiments/ninject2/src/Ninject/Activation/Strategies/MethodInjectionStrategy.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Strategies/PropertyInjectionStrategy.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Activation/Strategies/PropertyInjectionStrategy.cs
(original)
+++
experiments/ninject2/src/Ninject/Activation/Strategies/PropertyInjectionStrategy.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Activation/Strategies/StartableStrategy.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Activation/Strategies/StartableStrategy.cs
(original)
+++
experiments/ninject2/src/Ninject/Activation/Strategies/StartableStrategy.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/ActivationException.cs
==============================================================================
--- experiments/ninject2/src/Ninject/ActivationException.cs (original)
+++ experiments/ninject2/src/Ninject/ActivationException.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Attributes/ConstraintAttribute.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Attributes/ConstraintAttribute.cs
(original)
+++ experiments/ninject2/src/Ninject/Attributes/ConstraintAttribute.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Attributes/InjectAttribute.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Attributes/InjectAttribute.cs
(original)
+++ experiments/ninject2/src/Ninject/Attributes/InjectAttribute.cs Sun Feb
15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Attributes/NamedAttribute.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Attributes/NamedAttribute.cs (original)
+++ experiments/ninject2/src/Ninject/Attributes/NamedAttribute.cs Sun Feb
15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Components/ComponentContainer.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Components/ComponentContainer.cs
(original)
+++ experiments/ninject2/src/Ninject/Components/ComponentContainer.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Components/IComponentContainer.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Components/IComponentContainer.cs
(original)
+++ experiments/ninject2/src/Ninject/Components/IComponentContainer.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Components/INinjectComponent.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Components/INinjectComponent.cs
(original)
+++ experiments/ninject2/src/Ninject/Components/INinjectComponent.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Components/NinjectComponent.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Components/NinjectComponent.cs
(original)
+++ experiments/ninject2/src/Ninject/Components/NinjectComponent.cs Sun Feb
15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Events/BindingEventArgs.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Events/BindingEventArgs.cs (original)
+++ experiments/ninject2/src/Ninject/Events/BindingEventArgs.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Events/ModuleEventArgs.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Events/ModuleEventArgs.cs (original)
+++ experiments/ninject2/src/Ninject/Events/ModuleEventArgs.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/IInitializable.cs
==============================================================================
--- experiments/ninject2/src/Ninject/IInitializable.cs (original)
+++ experiments/ninject2/src/Ninject/IInitializable.cs Sun Feb 15 19:47:14
2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/IKernel.cs
==============================================================================
--- experiments/ninject2/src/Ninject/IKernel.cs (original)
+++ experiments/ninject2/src/Ninject/IKernel.cs Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,6 +22,7 @@
using Ninject.Events;
using Ninject.Infrastructure.Disposal;
using Ninject.Modules;
+using Ninject.Parameters;
using Ninject.Planning.Bindings;
using Ninject.Syntax;
#endregion
@@ -76,7 +77,8 @@
/// Injects the specified existing instance, without managing its
lifecycle.
/// </summary>
/// <param name="instance">The instance to inject.</param>
- void Inject(object instance);
+ /// <param name="parameters">The parameters to pass to the
request.</param>
+ void Inject(object instance, params IParameter[] parameters);
/// <summary>
/// Gets the bindings that match the request.
Modified: experiments/ninject2/src/Ninject/INinjectSettings.cs
==============================================================================
--- experiments/ninject2/src/Ninject/INinjectSettings.cs (original)
+++ experiments/ninject2/src/Ninject/INinjectSettings.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/IStartable.cs
==============================================================================
--- experiments/ninject2/src/Ninject/IStartable.cs (original)
+++ experiments/ninject2/src/Ninject/IStartable.cs Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Infrastructure/Disposal/DisposableObject.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Infrastructure/Disposal/DisposableObject.cs
(original)
+++
experiments/ninject2/src/Ninject/Infrastructure/Disposal/DisposableObject.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Infrastructure/Disposal/INotifyWhenDisposed.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Infrastructure/Disposal/INotifyWhenDisposed.cs
(original)
+++
experiments/ninject2/src/Ninject/Infrastructure/Disposal/INotifyWhenDisposed.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Infrastructure/IHaveKernel.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Infrastructure/IHaveKernel.cs
(original)
+++ experiments/ninject2/src/Ninject/Infrastructure/IHaveKernel.cs Sun Feb
15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForEventHandler.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForEventHandler.cs
(original)
+++
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForEventHandler.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForICollection.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForICollection.cs
(original)
+++
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForICollection.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForICustomAttributeProvider.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForICustomAttributeProvider.cs
(original)
+++
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForICustomAttributeProvider.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForIDictionary.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForIDictionary.cs
(original)
+++
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForIDictionary.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForIEnumerable.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForIEnumerable.cs
(original)
+++
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForIEnumerable.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForIList.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForIList.cs
(original)
+++
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForIList.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForTargetInvocationException.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForTargetInvocationException.cs
(original)
+++
experiments/ninject2/src/Ninject/Infrastructure/Language/ExtensionsForTargetInvocationException.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Infrastructure/LinqReflection.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Infrastructure/LinqReflection.cs
(original)
+++ experiments/ninject2/src/Ninject/Infrastructure/LinqReflection.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Infrastructure/Multimap.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Infrastructure/Multimap.cs (original)
+++ experiments/ninject2/src/Ninject/Infrastructure/Multimap.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Infrastructure/Tracing/IHaveTraceInfo.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Infrastructure/Tracing/IHaveTraceInfo.cs
(original)
+++
experiments/ninject2/src/Ninject/Infrastructure/Tracing/IHaveTraceInfo.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Infrastructure/Tracing/TraceInfo.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Infrastructure/Tracing/TraceInfo.cs
(original)
+++ experiments/ninject2/src/Ninject/Infrastructure/Tracing/TraceInfo.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Infrastructure/Tracing/TraceInfoProvider.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Infrastructure/Tracing/TraceInfoProvider.cs
(original)
+++
experiments/ninject2/src/Ninject/Infrastructure/Tracing/TraceInfoProvider.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Injection/IConstructorInjector.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Injection/IConstructorInjector.cs
(original)
+++ experiments/ninject2/src/Ninject/Injection/IConstructorInjector.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Injection/IInjectorFactory.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Injection/IInjectorFactory.cs
(original)
+++ experiments/ninject2/src/Ninject/Injection/IInjectorFactory.cs Sun Feb
15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Injection/IMethodInjector.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Injection/IMethodInjector.cs (original)
+++ experiments/ninject2/src/Ninject/Injection/IMethodInjector.cs Sun Feb
15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Injection/IPropertyInjector.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Injection/IPropertyInjector.cs
(original)
+++ experiments/ninject2/src/Ninject/Injection/IPropertyInjector.cs Sun Feb
15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Injection/Linq/ConstructorInjector.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Injection/Linq/ConstructorInjector.cs
(original)
+++ experiments/ninject2/src/Ninject/Injection/Linq/ConstructorInjector.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -53,7 +53,7 @@
protected override Expression<Func<object[], object>>
BuildExpression(ConstructorInfo member)
{
ParameterExpression argumentsParameter =
Expression.Parameter(typeof(object[]), "arguments");
- var arguments =
MethodInjectionExpressionHelper.CreateParameterExpressions(member,
argumentsParameter);
+ var arguments = ExpressionHelper.CreateParameterExpressions(member,
argumentsParameter);
NewExpression newCall = Expression.New(member, arguments);
Modified:
experiments/ninject2/src/Ninject/Injection/Linq/ExpressionBasedInjector.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Injection/Linq/ExpressionBasedInjector.cs
(original)
+++
experiments/ninject2/src/Ninject/Injection/Linq/ExpressionBasedInjector.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Copied: experiments/ninject2/src/Ninject/Injection/Linq/ExpressionHelper.cs
(from r143,
/experiments/ninject2/src/Ninject/Injection/Linq/MethodInjectionExpressionHelper.cs)
==============================================================================
---
/experiments/ninject2/src/Ninject/Injection/Linq/MethodInjectionExpressionHelper.cs
(original)
+++ experiments/ninject2/src/Ninject/Injection/Linq/ExpressionHelper.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +23,7 @@
namespace Ninject.Injection.Linq
{
- internal static class MethodInjectionExpressionHelper
+ internal static class ExpressionHelper
{
public static Expression[] CreateParameterExpressions(MethodBase method,
Expression argumentArrayExpression)
{
Modified: experiments/ninject2/src/Ninject/Injection/Linq/InjectorFactory.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Injection/Linq/InjectorFactory.cs
(original)
+++ experiments/ninject2/src/Ninject/Injection/Linq/InjectorFactory.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Injection/Linq/MethodInjector.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Injection/Linq/MethodInjector.cs
(original)
+++ experiments/ninject2/src/Ninject/Injection/Linq/MethodInjector.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Injection/Linq/MethodInjectorBase.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Injection/Linq/MethodInjectorBase.cs
(original)
+++ experiments/ninject2/src/Ninject/Injection/Linq/MethodInjectorBase.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -55,7 +55,7 @@
Expression instance = Expression.Convert(instanceParameter,
member.DeclaringType);
ParameterExpression argumentsParameter =
Expression.Parameter(typeof(object[]), "arguments");
- var arguments =
MethodInjectionExpressionHelper.CreateParameterExpressions(member,
argumentsParameter);
+ var arguments = ExpressionHelper.CreateParameterExpressions(member,
argumentsParameter);
MethodCallExpression call = Expression.Call(instance, member,
arguments);
Modified:
experiments/ninject2/src/Ninject/Injection/Linq/PropertyInjector.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Injection/Linq/PropertyInjector.cs
(original)
+++ experiments/ninject2/src/Ninject/Injection/Linq/PropertyInjector.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Injection/Linq/VoidMethodInjector.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Injection/Linq/VoidMethodInjector.cs
(original)
+++ experiments/ninject2/src/Ninject/Injection/Linq/VoidMethodInjector.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/KernelBase.cs
==============================================================================
--- experiments/ninject2/src/Ninject/KernelBase.cs (original)
+++ experiments/ninject2/src/Ninject/KernelBase.cs Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -200,7 +200,8 @@
/// Injects the specified existing instance, without managing its
lifecycle.
/// </summary>
/// <param name="instance">The instance to inject.</param>
- public void Inject(object instance)
+ /// <param name="parameters">The parameters to pass to the
request.</param>
+ public void Inject(object instance, params IParameter[] parameters)
{
throw new NotImplementedException();
}
@@ -225,12 +226,12 @@
/// Resolves the specified request.
/// </summary>
/// <param name="service">The service to resolve.</param>
- /// <param name="constraints">The constraints to apply to the bindings
to determine if they match the request.</param>
+ /// <param name="constraint">The constraint to apply to the bindings to
determine if they match the request.</param>
/// <param name="parameters">The parameters to pass to the
resolution.</param>
/// <returns>A series of hooks that can be used to resolve instances
that match the request.</returns>
- public virtual IEnumerable<IHook> Resolve(Type service,
IEnumerable<Func<IBindingMetadata, bool>> constraints,
IEnumerable<IParameter> parameters)
+ public virtual IEnumerable<IHook> Resolve(Type service,
Func<IBindingMetadata, bool> constraint, IEnumerable<IParameter> parameters)
{
- return Resolve(CreateDirectRequest(service, constraints, parameters));
+ return Resolve(CreateDirectRequest(service, constraint, parameters));
}
/// <summary>
@@ -250,7 +251,7 @@
}
return GetBindings(request)
- .Where(binding => binding.ConditionsSatisfiedBy(request) &&
request.ConstraintsSatisfiedBy(binding))
+ .Where(binding => binding.Matches(request) && request.Matches(binding))
.Select(binding => CreateHook(CreateContext(request, binding)));
}
@@ -320,12 +321,12 @@
/// Creates a request for the specified service.
/// </summary>
/// <param name="service">The service to resolve.</param>
- /// <param name="constraints">The constraints to apply to the bindings
to determine if they match the request.</param>
+ /// <param name="constraint">The constraint to apply to the bindings to
determine if they match the request.</param>
/// <param name="parameters">The parameters to pass to the
resolution.</param>
/// <returns>The created request.</returns>
- protected virtual IRequest CreateDirectRequest(Type service,
IEnumerable<Func<IBindingMetadata, bool>> constraints,
IEnumerable<IParameter> parameters)
+ protected virtual IRequest CreateDirectRequest(Type service,
Func<IBindingMetadata, bool> constraint, IEnumerable<IParameter> parameters)
{
- return new Request(service, constraints, parameters, null);
+ return new Request(service, constraint, parameters, null);
}
/// <summary>
Modified: experiments/ninject2/src/Ninject/Modules/IModule.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Modules/IModule.cs (original)
+++ experiments/ninject2/src/Ninject/Modules/IModule.cs Sun Feb 15 19:47:14
2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Modules/IModuleLoader.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Modules/IModuleLoader.cs (original)
+++ experiments/ninject2/src/Ninject/Modules/IModuleLoader.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Modules/Module.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Modules/Module.cs (original)
+++ experiments/ninject2/src/Ninject/Modules/Module.cs Sun Feb 15 19:47:14
2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Modules/ModuleLoader.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Modules/ModuleLoader.cs (original)
+++ experiments/ninject2/src/Ninject/Modules/ModuleLoader.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Ninject.csproj
==============================================================================
--- experiments/ninject2/src/Ninject/Ninject.csproj (original)
+++ experiments/ninject2/src/Ninject/Ninject.csproj Sun Feb 15 19:47:14 2009
@@ -111,7 +111,7 @@
<Compile Include="ActivationException.cs" />
<Compile Include="Infrastructure\Language\ExtensionsForIDictionary.cs"
/>
<Compile Include="Infrastructure\Language\ExtensionsForIList.cs" />
- <Compile Include="Injection\Linq\MethodInjectionExpressionHelper.cs" />
+ <Compile Include="Injection\Linq\ExpressionHelper.cs" />
<Compile Include="Syntax\ModuleLoadExtensions.cs" />
<Compile Include="Events\BindingEventArgs.cs" />
<Compile Include="Events\ModuleEventArgs.cs" />
Modified: experiments/ninject2/src/Ninject/NinjectSettings.cs
==============================================================================
--- experiments/ninject2/src/Ninject/NinjectSettings.cs (original)
+++ experiments/ninject2/src/Ninject/NinjectSettings.cs Sun Feb 15 19:47:14
2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Parameters/ConstructorArgument.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Parameters/ConstructorArgument.cs
(original)
+++ experiments/ninject2/src/Ninject/Parameters/ConstructorArgument.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Parameters/IParameter.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Parameters/IParameter.cs (original)
+++ experiments/ninject2/src/Ninject/Parameters/IParameter.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Parameters/Parameter.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Parameters/Parameter.cs (original)
+++ experiments/ninject2/src/Ninject/Parameters/Parameter.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Parameters/PropertyValue.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Parameters/PropertyValue.cs (original)
+++ experiments/ninject2/src/Ninject/Parameters/PropertyValue.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Planning/Bindings/Binding.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/Bindings/Binding.cs (original)
+++ experiments/ninject2/src/Ninject/Planning/Bindings/Binding.cs Sun Feb
15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -45,9 +45,9 @@
public IBindingMetadata Metadata { get; private set; }
/// <summary>
- /// Gets the conditions defined for the binding.
+ /// Gets or sets the condition defined for the binding.
/// </summary>
- public ICollection<Func<IRequest, bool>> Conditions { get; private set; }
+ public Func<IRequest, bool> Condition { get; set; }
/// <summary>
/// Gets the parameters defined for the binding.
@@ -94,7 +94,6 @@
{
Service = service;
Metadata = metadata;
- Conditions = new List<Func<IRequest, bool>>();
Parameters = new List<IParameter>();
ActivationActions = new List<Action<IContext>>();
DeactivationActions = new List<Action<IContext>>();
@@ -129,9 +128,9 @@
/// </summary>
/// <param name="request">The request.</param>
/// <returns><c>True</c> if the request satisfies the conditions;
otherwise <c>false</c>.</returns>
- public bool ConditionsSatisfiedBy(IRequest request)
+ public bool Matches(IRequest request)
{
- return Conditions.All(condition => condition(request));
+ return Condition == null || Condition(request);
}
}
}
Modified:
experiments/ninject2/src/Ninject/Planning/Bindings/BindingBuilder.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/Bindings/BindingBuilder.cs
(original)
+++ experiments/ninject2/src/Ninject/Planning/Bindings/BindingBuilder.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -32,7 +32,7 @@
/// <summary>
/// Provides a root for the fluent syntax associated with an <see
cref="Binding"/>.
/// </summary>
- public class BindingBuilder<T> : IBindingToSyntax<T>,
IBindingWhenInNamedOrWithSyntax<T>, IBindingInNamedWithOrOnSyntax<T>,
IBindingNamedWithOrOnSyntax<T>, IBindingWithOrOnSyntax<T>
+ public class BindingBuilder<T> : IBindingToSyntax<T>,
IBindingWhenInNamedWithOrOnSyntax<T>, IBindingInNamedWithOrOnSyntax<T>,
IBindingNamedWithOrOnSyntax<T>, IBindingWithOrOnSyntax<T>
{
/// <summary>
/// Gets the binding being built.
@@ -51,7 +51,7 @@
/// <summary>
/// Indicates that the service should be self-bound.
/// </summary>
- public IBindingWhenInNamedOrWithSyntax<T> ToSelf()
+ public IBindingWhenInNamedWithOrOnSyntax<T> ToSelf()
{
Binding.ProviderCallback =
StandardProvider.GetCreationCallback(Binding.Service);
Binding.IntrospectionInfo += " to self";
@@ -62,7 +62,7 @@
/// Indicates that the service should be bound to the specified
implementation type.
/// </summary>
/// <typeparam name="TImplementation">The implementation
type.</typeparam>
- public IBindingWhenInNamedOrWithSyntax<T> To<TImplementation>()
+ public IBindingWhenInNamedWithOrOnSyntax<T> To<TImplementation>()
where TImplementation : T
{
Binding.ProviderCallback =
StandardProvider.GetCreationCallback(typeof(TImplementation));
@@ -74,7 +74,7 @@
/// Indicates that the service should be bound to the specified
implementation type.
/// </summary>
/// <param name="implementation">The implementation type.</param>
- public IBindingWhenInNamedOrWithSyntax<T> To(Type implementation)
+ public IBindingWhenInNamedWithOrOnSyntax<T> To(Type implementation)
{
Binding.ProviderCallback =
StandardProvider.GetCreationCallback(implementation);
Binding.IntrospectionInfo += " to " + implementation;
@@ -86,7 +86,7 @@
/// The instance will be activated via the kernel when an instance of
the service is activated.
/// </summary>
/// <typeparam name="TProvider">The type of provider to
activate.</typeparam>
- public IBindingWhenInNamedOrWithSyntax<T> ToProvider<TProvider>()
+ public IBindingWhenInNamedWithOrOnSyntax<T> ToProvider<TProvider>()
where TProvider : IProvider
{
Binding.ProviderCallback = ctx => ctx.Kernel.Get<TProvider>();
@@ -98,7 +98,7 @@
/// Indicates that the service should be bound to the specified provider.
/// </summary>
/// <param name="provider">The provider.</param>
- public IBindingWhenInNamedOrWithSyntax<T> ToProvider(IProvider provider)
+ public IBindingWhenInNamedWithOrOnSyntax<T> ToProvider(IProvider
provider)
{
Binding.ProviderCallback = ctx => provider;
Binding.IntrospectionInfo += " to external instance of provider " +
provider.GetType();
@@ -109,7 +109,7 @@
/// Indicates that the service should be bound to the specified callback
method.
/// </summary>
/// <param name="method">The method.</param>
- public IBindingWhenInNamedOrWithSyntax<T> ToMethod(Func<IContext, T>
method)
+ public IBindingWhenInNamedWithOrOnSyntax<T> ToMethod(Func<IContext, T>
method)
{
Binding.ProviderCallback = ctx => new CallbackProvider<T>(method);
Binding.IntrospectionInfo += " to method " + method.Method;
@@ -120,7 +120,7 @@
/// Indicates that the service should be bound to the specified constant
value.
/// </summary>
/// <param name="value">The constant value.</param>
- public IBindingWhenInNamedOrWithSyntax<T> ToConstant(T value)
+ public IBindingWhenInNamedWithOrOnSyntax<T> ToConstant(T value)
{
Binding.ProviderCallback = ctx => new ConstantProvider<T>(value);
Binding.IntrospectionInfo += " to constant " + value;
@@ -131,9 +131,9 @@
/// Indicates that the binding should be used only for requests that
support the specified condition.
/// </summary>
/// <param name="condition">The condition.</param>
- public IBindingWhenInNamedOrWithSyntax<T> When(Func<IRequest, bool>
condition)
+ public IBindingInNamedWithOrOnSyntax<T> When(Func<IRequest, bool>
condition)
{
- Binding.Conditions.Add(condition);
+ Binding.Condition = condition;
Binding.IntrospectionInfo += " (conditionally)";
return this;
}
@@ -142,7 +142,7 @@
/// Indicates that the binding should be used only for injections on the
specified type.
/// </summary>
/// <typeparam name="TParent">The type.</typeparam>
- public IBindingWhenInNamedOrWithSyntax<T> WhenInjectedInto<TParent>()
+ public IBindingInNamedWithOrOnSyntax<T> WhenInjectedInto<TParent>()
{
return WhenInjectedInto(typeof(TParent));
}
@@ -151,9 +151,10 @@
/// Indicates that the binding should be used only for injections on the
specified type.
/// </summary>
/// <param name="parent">The type.</param>
- public IBindingWhenInNamedOrWithSyntax<T> WhenInjectedInto(Type parent)
+ public IBindingInNamedWithOrOnSyntax<T> WhenInjectedInto(Type parent)
{
- Binding.Conditions.Add(r => r.Target.Member.ReflectedType == parent);
+ Binding.Condition = r => r.Target.Member.ReflectedType == parent;
+ Binding.IntrospectionInfo += " (conditionally)";
return this;
}
@@ -162,7 +163,7 @@
/// an attribute of the specified type.
/// </summary>
/// <typeparam name="TAttribute">The type of attribute.</typeparam>
- public IBindingWhenInNamedOrWithSyntax<T> WhenMemberHas<TAttribute>()
where TAttribute : Attribute
+ public IBindingInNamedWithOrOnSyntax<T> WhenMemberHas<TAttribute>()
where TAttribute : Attribute
{
return WhenMemberHas(typeof(TAttribute));
}
@@ -172,12 +173,14 @@
/// an attribute of the specified type.
/// </summary>
/// <param name="attributeType">The type of attribute.</param>
- public IBindingWhenInNamedOrWithSyntax<T> WhenMemberHas(Type
attributeType)
+ public IBindingInNamedWithOrOnSyntax<T> WhenMemberHas(Type attributeType)
{
if (!typeof(Attribute).IsAssignableFrom(attributeType))
throw new InvalidOperationException();
- Binding.Conditions.Add(r =>
r.Target.Member.HasAttribute(attributeType));
+ Binding.Condition = r => r.Target.Member.HasAttribute(attributeType);
+ Binding.IntrospectionInfo += " (conditionally)";
+
return this;
}
@@ -186,7 +189,7 @@
/// an attribute of the specified type.
/// </summary>
/// <typeparam name="TAttribute">The type of attribute.</typeparam>
- public IBindingWhenInNamedOrWithSyntax<T> WhenTargetHas<TAttribute>()
where TAttribute : Attribute
+ public IBindingInNamedWithOrOnSyntax<T> WhenTargetHas<TAttribute>()
where TAttribute : Attribute
{
return WhenTargetHas(typeof(TAttribute));
}
@@ -196,12 +199,14 @@
/// an attribute of the specified type.
/// </summary>
/// <param name="attributeType">The type of attribute.</param>
- public IBindingWhenInNamedOrWithSyntax<T> WhenTargetHas(Type
attributeType)
+ public IBindingInNamedWithOrOnSyntax<T> WhenTargetHas(Type attributeType)
{
if (!typeof(Attribute).IsAssignableFrom(attributeType))
throw new InvalidOperationException();
- Binding.Conditions.Add(r => r.Target.HasAttribute(attributeType));
+ Binding.Condition = r => r.Target.HasAttribute(attributeType);
+ Binding.IntrospectionInfo += " (conditionally)";
+
return this;
}
Modified:
experiments/ninject2/src/Ninject/Planning/Bindings/BindingMetadata.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/Bindings/BindingMetadata.cs
(original)
+++ experiments/ninject2/src/Ninject/Planning/Bindings/BindingMetadata.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Planning/Bindings/IBinding.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/Bindings/IBinding.cs
(original)
+++ experiments/ninject2/src/Ninject/Planning/Bindings/IBinding.cs Sun Feb
15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -40,9 +40,9 @@
IBindingMetadata Metadata { get; }
/// <summary>
- /// Gets the conditions defined for the binding.
+ /// Gets or sets the condition defined for the binding.
/// </summary>
- ICollection<Func<IRequest, bool>> Conditions { get; }
+ Func<IRequest, bool> Condition { get; set; }
/// <summary>
/// Gets the parameters defined for the binding.
@@ -74,10 +74,11 @@
object GetScope(IContext context);
/// <summary>
- /// Determines whether the specified request satisfies the conditions
defined on this binding.
+ /// Determines whether the specified request satisfies the condition
defined on the binding,
+ /// if one was defined.
/// </summary>
/// <param name="request">The request.</param>
- /// <returns><c>True</c> if the request satisfies the conditions;
otherwise <c>false</c>.</returns>
- bool ConditionsSatisfiedBy(IRequest request);
+ /// <returns><c>True</c> if the request satisfies the condition;
otherwise <c>false</c>.</returns>
+ bool Matches(IRequest request);
}
}
Modified:
experiments/ninject2/src/Ninject/Planning/Bindings/IBindingMetadata.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/Bindings/IBindingMetadata.cs
(original)
+++ experiments/ninject2/src/Ninject/Planning/Bindings/IBindingMetadata.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Planning/Directives/ConstructorInjectionDirective.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Planning/Directives/ConstructorInjectionDirective.cs
(original)
+++
experiments/ninject2/src/Ninject/Planning/Directives/ConstructorInjectionDirective.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Planning/Directives/IDirective.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/Directives/IDirective.cs
(original)
+++ experiments/ninject2/src/Ninject/Planning/Directives/IDirective.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Planning/Directives/MethodInjectionDirective.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Planning/Directives/MethodInjectionDirective.cs
(original)
+++
experiments/ninject2/src/Ninject/Planning/Directives/MethodInjectionDirective.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Planning/Directives/MethodInjectionDirectiveBase.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Planning/Directives/MethodInjectionDirectiveBase.cs
(original)
+++
experiments/ninject2/src/Ninject/Planning/Directives/MethodInjectionDirectiveBase.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Planning/Directives/PropertyInjectionDirective.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Planning/Directives/PropertyInjectionDirective.cs
(original)
+++
experiments/ninject2/src/Ninject/Planning/Directives/PropertyInjectionDirective.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Planning/IPlan.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/IPlan.cs (original)
+++ experiments/ninject2/src/Ninject/Planning/IPlan.cs Sun Feb 15 19:47:14
2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Planning/IPlanner.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/IPlanner.cs (original)
+++ experiments/ninject2/src/Ninject/Planning/IPlanner.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Planning/Plan.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/Plan.cs (original)
+++ experiments/ninject2/src/Ninject/Planning/Plan.cs Sun Feb 15 19:47:14
2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Planning/Planner.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/Planner.cs (original)
+++ experiments/ninject2/src/Ninject/Planning/Planner.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Planning/Strategies/ConstructorReflectionStrategy.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Planning/Strategies/ConstructorReflectionStrategy.cs
(original)
+++
experiments/ninject2/src/Ninject/Planning/Strategies/ConstructorReflectionStrategy.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Planning/Strategies/IPlanningStrategy.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Planning/Strategies/IPlanningStrategy.cs
(original)
+++
experiments/ninject2/src/Ninject/Planning/Strategies/IPlanningStrategy.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Planning/Strategies/MethodReflectionStrategy.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Planning/Strategies/MethodReflectionStrategy.cs
(original)
+++
experiments/ninject2/src/Ninject/Planning/Strategies/MethodReflectionStrategy.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Planning/Strategies/PropertyReflectionStrategy.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Planning/Strategies/PropertyReflectionStrategy.cs
(original)
+++
experiments/ninject2/src/Ninject/Planning/Strategies/PropertyReflectionStrategy.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Planning/Targets/ITarget.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/Targets/ITarget.cs (original)
+++ experiments/ninject2/src/Ninject/Planning/Targets/ITarget.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -45,10 +45,9 @@
MemberInfo Member { get; }
/// <summary>
- /// Reads the constraints from the target.
+ /// Gets the constraint defined on the target.
/// </summary>
- /// <returns>A series of constraints read from the target.</returns>
- IEnumerable<Func<IBindingMetadata, bool>> GetConstraints();
+ Func<IBindingMetadata, bool> Constraint { get; }
/// <summary>
/// Resolves a value for the target within the specified parent context.
Modified:
experiments/ninject2/src/Ninject/Planning/Targets/ParameterTarget.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/Targets/ParameterTarget.cs
(original)
+++ experiments/ninject2/src/Ninject/Planning/Targets/ParameterTarget.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Planning/Targets/PropertyTarget.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/Targets/PropertyTarget.cs
(original)
+++ experiments/ninject2/src/Ninject/Planning/Targets/PropertyTarget.cs Sun
Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Planning/Targets/Target.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Planning/Targets/Target.cs (original)
+++ experiments/ninject2/src/Ninject/Planning/Targets/Target.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,6 +34,8 @@
public abstract class Target<T> : ITarget
where T : ICustomAttributeProvider
{
+ private Func<IBindingMetadata, bool> _constraint;
+
/// <summary>
/// Gets the member that contains the target.
/// </summary>
@@ -55,6 +57,18 @@
public abstract Type Type { get; }
/// <summary>
+ /// Gets the constraint defined on the target.
+ /// </summary>
+ public Func<IBindingMetadata, bool> Constraint
+ {
+ get
+ {
+ if (_constraint == null) _constraint = ReadConstraintFromAttributes();
+ return _constraint;
+ }
+ }
+
+ /// <summary>
/// Initializes a new instance of the <see cref="Target<T>"/>
class.
/// </summary>
/// <param name="member">The member that contains the target.</param>
@@ -98,15 +112,6 @@
}
/// <summary>
- /// Reads the constraints from the target.
- /// </summary>
- /// <returns>A series of constraints read from the target.</returns>
- public IEnumerable<Func<IBindingMetadata, bool>> GetConstraints()
- {
- return Site.GetAttributes<ConstraintAttribute>().Select(a => new
Func<IBindingMetadata, bool>(a.Matches));
- }
-
- /// <summary>
/// Resolves a value for the target within the specified parent context.
/// </summary>
/// <param name="parent">The parent context.</param>
@@ -138,6 +143,16 @@
{
var request = parent.Request.CreateChild(service, this);
return parent.Kernel.Resolve(request).Select(hook => hook.Resolve());
+ }
+
+ private Func<IBindingMetadata, bool> ReadConstraintFromAttributes()
+ {
+ ConstraintAttribute[] attributes =
Site.GetAttributes<ConstraintAttribute>().ToArray();
+
+ if (attributes.Length == 0) return null;
+ if (attributes.Length == 1) return attributes[0].Matches;
+
+ return metadata => attributes.All(attribute =>
attribute.Matches(metadata));
}
}
}
Modified: experiments/ninject2/src/Ninject/Properties/AssemblyInfo.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Properties/AssemblyInfo.cs (original)
+++ experiments/ninject2/src/Ninject/Properties/AssemblyInfo.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Selection/Heuristics/IConstructorScorer.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Selection/Heuristics/IConstructorScorer.cs
(original)
+++
experiments/ninject2/src/Ninject/Selection/Heuristics/IConstructorScorer.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Selection/Heuristics/IMethodInjectionHeuristic.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Selection/Heuristics/IMethodInjectionHeuristic.cs
(original)
+++
experiments/ninject2/src/Ninject/Selection/Heuristics/IMethodInjectionHeuristic.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Selection/Heuristics/IPropertyInjectionHeuristic.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Selection/Heuristics/IPropertyInjectionHeuristic.cs
(original)
+++
experiments/ninject2/src/Ninject/Selection/Heuristics/IPropertyInjectionHeuristic.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Selection/Heuristics/StandardConstructorScorer.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Selection/Heuristics/StandardConstructorScorer.cs
(original)
+++
experiments/ninject2/src/Ninject/Selection/Heuristics/StandardConstructorScorer.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Selection/Heuristics/StandardMethodInjectionHeuristic.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Selection/Heuristics/StandardMethodInjectionHeuristic.cs
(original)
+++
experiments/ninject2/src/Ninject/Selection/Heuristics/StandardMethodInjectionHeuristic.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified:
experiments/ninject2/src/Ninject/Selection/Heuristics/StandardPropertyInjectionHeuristic.cs
==============================================================================
---
experiments/ninject2/src/Ninject/Selection/Heuristics/StandardPropertyInjectionHeuristic.cs
(original)
+++
experiments/ninject2/src/Ninject/Selection/Heuristics/StandardPropertyInjectionHeuristic.cs
Sun Feb 15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Selection/ISelector.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Selection/ISelector.cs (original)
+++ experiments/ninject2/src/Ninject/Selection/ISelector.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Selection/Selector.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Selection/Selector.cs (original)
+++ experiments/ninject2/src/Ninject/Selection/Selector.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/StandardKernel.cs
==============================================================================
--- experiments/ninject2/src/Ninject/StandardKernel.cs (original)
+++ experiments/ninject2/src/Ninject/StandardKernel.cs Sun Feb 15 19:47:14
2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Syntax/BindingSyntax.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Syntax/BindingSyntax.cs (original)
+++ experiments/ninject2/src/Ninject/Syntax/BindingSyntax.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -31,44 +31,44 @@
/// <summary>
/// Indicates that the service should be self-bound.
/// </summary>
- IBindingWhenInNamedOrWithSyntax<T> ToSelf();
+ IBindingWhenInNamedWithOrOnSyntax<T> ToSelf();
/// <summary>
/// Indicates that the service should be bound to the specified
implementation type.
/// </summary>
/// <typeparam name="TImplementation">The implementation
type.</typeparam>
- IBindingWhenInNamedOrWithSyntax<T> To<TImplementation>() where
TImplementation : T;
+ IBindingWhenInNamedWithOrOnSyntax<T> To<TImplementation>() where
TImplementation : T;
/// <summary>
/// Indicates that the service should be bound to the specified
implementation type.
/// </summary>
/// <param name="implementation">The implementation type.</param>
- IBindingWhenInNamedOrWithSyntax<T> To(Type implementation);
+ IBindingWhenInNamedWithOrOnSyntax<T> To(Type implementation);
/// <summary>
/// Indicates that the service should be bound to an instance of the
specified provider type.
/// The instance will be activated via the kernel when an instance of
the service is activated.
/// </summary>
/// <typeparam name="TProvider">The type of provider to
activate.</typeparam>
- IBindingWhenInNamedOrWithSyntax<T> ToProvider<TProvider>() where
TProvider : IProvider;
+ IBindingWhenInNamedWithOrOnSyntax<T> ToProvider<TProvider>() where
TProvider : IProvider;
/// <summary>
/// Indicates that the service should be bound to the specified provider.
/// </summary>
/// <param name="provider">The provider.</param>
- IBindingWhenInNamedOrWithSyntax<T> ToProvider(IProvider provider);
+ IBindingWhenInNamedWithOrOnSyntax<T> ToProvider(IProvider provider);
/// <summary>
/// Indicates that the service should be bound to the specified callback
method.
/// </summary>
/// <param name="method">The method.</param>
- IBindingWhenInNamedOrWithSyntax<T> ToMethod(Func<IContext, T> method);
+ IBindingWhenInNamedWithOrOnSyntax<T> ToMethod(Func<IContext, T> method);
/// <summary>
/// Indicates that the service should be bound to the specified constant
value.
/// </summary>
/// <param name="value">The constant value.</param>
- IBindingWhenInNamedOrWithSyntax<T> ToConstant(T value);
+ IBindingWhenInNamedWithOrOnSyntax<T> ToConstant(T value);
}
/// <summary>
@@ -81,47 +81,47 @@
/// Indicates that the binding should be used only for requests that
support the specified condition.
/// </summary>
/// <param name="condition">The condition.</param>
- IBindingWhenInNamedOrWithSyntax<T> When(Func<IRequest, bool> condition);
+ IBindingInNamedWithOrOnSyntax<T> When(Func<IRequest, bool> condition);
/// <summary>
/// Indicates that the binding should be used only for injections on the
specified type.
/// </summary>
/// <typeparam name="TParent">The type.</typeparam>
- IBindingWhenInNamedOrWithSyntax<T> WhenInjectedInto<TParent>();
+ IBindingInNamedWithOrOnSyntax<T> WhenInjectedInto<TParent>();
/// <summary>
/// Indicates that the binding should be used only for injections on the
specified type.
/// </summary>
/// <param name="parent">The type.</param>
- IBindingWhenInNamedOrWithSyntax<T> WhenInjectedInto(Type parent);
+ IBindingInNamedWithOrOnSyntax<T> WhenInjectedInto(Type parent);
/// <summary>
/// Indicates that the binding should be used only when the member being
injected has
/// an attribute of the specified type.
/// </summary>
/// <typeparam name="TAttribute">The type of attribute.</typeparam>
- IBindingWhenInNamedOrWithSyntax<T> WhenMemberHas<TAttribute>() where
TAttribute : Attribute;
+ IBindingInNamedWithOrOnSyntax<T> WhenMemberHas<TAttribute>() where
TAttribute : Attribute;
/// <summary>
/// Indicates that the binding should be used only when the target being
injected has
/// an attribute of the specified type.
/// </summary>
/// <typeparam name="TAttribute">The type of attribute.</typeparam>
- IBindingWhenInNamedOrWithSyntax<T> WhenTargetHas<TAttribute>() where
TAttribute : Attribute;
+ IBindingInNamedWithOrOnSyntax<T> WhenTargetHas<TAttribute>() where
TAttribute : Attribute;
/// <summary>
/// Indicates that the binding should be used only when the member being
injected has
/// an attribute of the specified type.
/// </summary>
/// <param name="attributeType">The type of attribute.</param>
- IBindingWhenInNamedOrWithSyntax<T> WhenMemberHas(Type attributeType);
+ IBindingInNamedWithOrOnSyntax<T> WhenMemberHas(Type attributeType);
/// <summary>
/// Indicates that the binding should be used only when the target being
injected has
/// an attribute of the specified type.
/// </summary>
/// <param name="attributeType">The type of attribute.</param>
- IBindingWhenInNamedOrWithSyntax<T> WhenTargetHas(Type attributeType);
+ IBindingInNamedWithOrOnSyntax<T> WhenTargetHas(Type attributeType);
}
/// <summary>
@@ -248,7 +248,7 @@
/// Used to set the condition, scope, name, or add additional information
or actions to a binding.
/// </summary>
/// <typeparam name="T">The service being bound.</typeparam>
- public interface IBindingWhenInNamedOrWithSyntax<T> :
IBindingWhenSyntax<T>, IBindingInSyntax<T>, IBindingNamedSyntax<T>,
IBindingWithSyntax<T> { }
+ public interface IBindingWhenInNamedWithOrOnSyntax<T> :
IBindingWhenSyntax<T>, IBindingInSyntax<T>, IBindingNamedSyntax<T>,
IBindingWithSyntax<T>, IBindingOnSyntax<T> { }
/// <summary>
/// Used to set the scope, name, or add additional information or actions
to a binding.
Modified: experiments/ninject2/src/Ninject/Syntax/IBindingRoot.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Syntax/IBindingRoot.cs (original)
+++ experiments/ninject2/src/Ninject/Syntax/IBindingRoot.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Syntax/IFluentSyntax.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Syntax/IFluentSyntax.cs (original)
+++ experiments/ninject2/src/Ninject/Syntax/IFluentSyntax.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Syntax/IResolutionRoot.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Syntax/IResolutionRoot.cs (original)
+++ experiments/ninject2/src/Ninject/Syntax/IResolutionRoot.cs Sun Feb 15
19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -41,10 +41,10 @@
/// Resolves the specified request.
/// </summary>
/// <param name="service">The service to resolve.</param>
- /// <param name="constraints">The constraints to apply to the bindings
to determine if they match the request.</param>
+ /// <param name="constraint">The constraint to apply to the bindings to
determine if they match the request.</param>
/// <param name="parameters">The parameters to pass to the
resolution.</param>
/// <returns>A series of hooks that can be used to resolve instances
that match the request.</returns>
- IEnumerable<IHook> Resolve(Type service,
IEnumerable<Func<IBindingMetadata, bool>> constraints,
IEnumerable<IParameter> parameters);
+ IEnumerable<IHook> Resolve(Type service, Func<IBindingMetadata, bool>
constraint, IEnumerable<IParameter> parameters);
/// <summary>
/// Resolves the specified request.
Modified: experiments/ninject2/src/Ninject/Syntax/ModuleLoadExtensions.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Syntax/ModuleLoadExtensions.cs
(original)
+++ experiments/ninject2/src/Ninject/Syntax/ModuleLoadExtensions.cs Sun Feb
15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Modified: experiments/ninject2/src/Ninject/Syntax/ResolutionExtensions.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Syntax/ResolutionExtensions.cs
(original)
+++ experiments/ninject2/src/Ninject/Syntax/ResolutionExtensions.cs Sun Feb
15 19:47:14 2009
@@ -1,5 +1,5 @@
#region License
-// Author: Nate Kohari <
nko...@gmail.com>
+// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -65,7 +65,7 @@
/// <returns>An instance of the service.</returns>
public static T Get<T>(this IResolutionRoot root, Func<IBindingMetadata,
bool> constraint, params IParameter[] parameters)
{
- return (T)root.Resolve(typeof(T), new[] { constraint },
parameters).Select(hook => hook.Resolve()).FirstOrDefault();
+ return (T)root.Resolve(typeof(T), constraint, parameters).Select(hook
=> hook.Resolve()).FirstOrDefault();
}
/// <summary>
@@ -103,7 +103,7 @@
/// <returns>A series of instances of the service.</returns>
public static IEnumerable<T> GetAll<T>(this IResolutionRoot root,
Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
{
- return root.Resolve(typeof(T), new[] { constraint },
parameters).Select(hook => hook.Resolve()).Cast<T>();
+ return root.Resolve(typeof(T), constraint, parameters).Select(hook =>
hook.Resolve()).Cast<T>();
}
/// <summary>
@@ -141,7 +141,7 @@
/// <returns>An instance of the service.</returns>
public static object Get(this IResolutionRoot root, Type service,
Func<IBindingMetadata, bool> constraint, params IParameter[] parameters)
{
- return root.Resolve(service, new[] { constraint },
parameters).Select(hook => hook.Resolve()).FirstOrDefault();
+ return root.Resolve(service, constraint, parameters).Select(hook =>
hook.Resolve()).FirstOrDefault();
}
/// <summary>
@@ -179,7 +179,7 @@
/// <returns>A series of instances of the service.</returns>
public static IEnumerable<object> GetAll(this IResolutionRoot root, Type
service, Func<IBindingMetadata, bool> constraint, params IParameter[]
parameters)
{
- return root.Resolve(service, new[] { constraint },
parameters).Select(hook => hook.Resolve());
+ return root.Resolve(service, constraint, parameters).Select(hook =>
hook.Resolve());
}
}
}