Author: nkohari
Date: Mon Feb 16 18:23:13 2009
New Revision: 145
Added:
experiments/ninject2/build-release.cmd
experiments/ninject2/src/Ninject.Tests/Integration/CircularDependenciesTests.cs
- copied, changed from r142,
/experiments/ninject2/src/Ninject.Tests/Integration/SpecialResolutionTests.cs
experiments/ninject2/src/Ninject/Activation/Hooks/ContextHook.cs
- copied, changed from r144,
/experiments/ninject2/src/Ninject/Activation/Hooks/ContextResolutionHook.cs
Removed:
experiments/ninject2/src/Ninject/Activation/Hooks/ContextResolutionHook.cs
Modified:
experiments/ninject2/Ninject.build
experiments/ninject2/Ninject.sln
experiments/ninject2/src/Ninject.Tests/Ninject.Tests.csproj
experiments/ninject2/src/Ninject.Tests/Unit/ConstructorInjectorTests.cs
experiments/ninject2/src/Ninject.Tests/Unit/MethodInjectorTests.cs
experiments/ninject2/src/Ninject.Tests/Unit/VoidMethodInjectorTests.cs
experiments/ninject2/src/Ninject/Activation/IRequest.cs
experiments/ninject2/src/Ninject/Activation/Providers/StandardProvider.cs
experiments/ninject2/src/Ninject/Activation/Request.cs
experiments/ninject2/src/Ninject/Injection/Linq/ConstructorInjector.cs
experiments/ninject2/src/Ninject/Injection/Linq/MethodInjectorBase.cs
experiments/ninject2/src/Ninject/KernelBase.cs
experiments/ninject2/src/Ninject/Modules/IModuleLoader.cs
experiments/ninject2/src/Ninject/Modules/ModuleLoader.cs
experiments/ninject2/src/Ninject/Ninject.csproj
experiments/ninject2/src/Ninject/StandardKernel.cs
experiments/ninject2/src/Ninject/Syntax/ModuleLoadExtensions.cs
experiments/ninject2/src/SharedAssemblyInfo.cs
Log:
Modified: experiments/ninject2/Ninject.build
==============================================================================
--- experiments/ninject2/Ninject.build (original)
+++ experiments/ninject2/Ninject.build Mon Feb 16 18:23:13 2009
@@ -110,9 +110,15 @@
<property name="build.defines"
value="${global.build.defines},SILVERLIGHT,SILVERLIGHT_20,NO_WEB,NO_PARTIAL_TRUST,NO_EXCEPTION_SERIALIZATION,NO_DEBUG_SYMBOLS"/>
</target>
+ <target name="config-platform-mono-2.0">
+ <property name="nant.settings.currentframework" value="mono-2.0"/>
+ <property name="build.defines"
value="${global.build.defines},NET,NET_35,MONO"/>
+ </target>
+
<target name="core" depends="init">
<csc noconfig="true" warnaserror="true" target="library"
debug="${build.debug}" optimize="${build.optimize}"
define="${build.defines}"
keyfile="${path.src}/Ninject.snk"
output="${current.path.build}/Ninject.dll">
+ <arg line="/filealign:512" unless="${build.platform == 'mono-2.0'}"/>
<sources basedir="${path.src}">
<include name="${build.asminfo}"/>
<include name="Ninject/**/*.cs"/>
@@ -121,17 +127,15 @@
<include name="mscorlib.dll"/>
<include name="System.dll"/>
<include name="System.Core.dll"/>
- <include name="System.Web.dll"/>
+ <include name="System.Web.dll" unless="${build.platform
== 'silverlight-2.0'}"/>
</references>
- <nowarn>
- <warning number="1584"/>
- </nowarn>
</csc>
</target>
<target name="csl" depends="init core">
- <csc keyfile="${path.src}/Ninject.snk" noconfig="true"
warnaserror="true" target="library" debug="${build.debug}"
optimize="${build.optimize}" define="${build.defines}"
-
output="${current.path.build.extensions}/CommonServiceLocator.NinjectAdapter.dll">
+ <csc noconfig="true" warnaserror="true" target="library"
debug="${build.debug}" optimize="${build.optimize}"
define="${build.defines}"
+ keyfile="${path.src}/Ninject.snk"
output="${current.path.build.extensions}/CommonServiceLocator.NinjectAdapter.dll">
+ <arg line="/filealign:512" unless="${build.platform == 'mono-2.0'}"/>
<sources basedir="${path.src}">
<include name="${build.asminfo}"/>
<include name="CommonServiceLocator.NinjectAdapter/**/*.cs"/>
@@ -144,15 +148,13 @@
<include name="Ninject.dll"/>
<include name="lib/Microsoft.Practices.ServiceLocation.dll"/>
</references>
- <nowarn>
- <warning number="1584"/>
- </nowarn>
</csc>
</target>
- <target name="mvc" depends="init core">
- <csc keyfile="${path.src}/Ninject.snk" noconfig="true"
warnaserror="true" target="library" debug="${build.debug}"
optimize="${build.optimize}" define="${build.defines}"
- output="${current.path.build.extensions}/Ninject.Web.Mvc.dll">
+ <target name="mvc" depends="init core" unless="${build.platform
== 'silverlight-2.0'}">
+ <csc noconfig="true" warnaserror="true" target="library"
debug="${build.debug}" optimize="${build.optimize}"
define="${build.defines}"
+ keyfile="${path.src}/Ninject.snk"
output="${current.path.build.extensions}/Ninject.Web.Mvc.dll">
+ <arg line="/filealign:512" unless="${build.platform == 'mono-2.0'}"/>
<sources basedir="${path.src}">
<include name="${build.asminfo}"/>
<include name="Ninject.Web.Mvc/**/*.cs"/>
@@ -167,13 +169,10 @@
<include name="lib/System.Web.Mvc.dll"/>
<include name="lib/System.Web.Routing.dll"/>
</references>
- <nowarn>
- <warning number="1584"/>
- </nowarn>
</csc>
</target>
- <target name="compile-tests" depends="core" unless="${skip.tests}">
+ <target name="compile-tests" depends="core" if="${build.platform
== 'net-3.5'}" unless="${skip.tests}">
<mkdir dir="${current.path.test}"/>
<copy todir="${current.path.test}" flatten="true">
<fileset basedir="${current.path.build}">
@@ -210,7 +209,7 @@
</csc>
</target>
- <target name="test" depends="compile-tests" unless="${skip.tests}">
+ <target name="test" depends="compile-tests" if="${build.platform
== 'net-3.5'}" unless="${skip.tests}">
<xunit workingDir="${current.path.test}" assembly="Ninject.Tests.dll"
html="${current.path.test}/results.html"/>
<exec verbose="true" program="${path.tools.ncover}/ncover.console.exe"
workingdir="${current.path.test}"
commandline=""${path.tools.xunit}\xunit.console.exe"
"Ninject.Tests.dll" //reg //w "." //x
"coverage.xml""/>
Modified: experiments/ninject2/Ninject.sln
==============================================================================
--- experiments/ninject2/Ninject.sln (original)
+++ experiments/ninject2/Ninject.sln Mon Feb 16 18:23:13 2009
@@ -9,6 +9,8 @@
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution
Items", "Solution Items", "{3E299B94-5F07-49DE-8226-55EDC56F13E3}"
ProjectSection(SolutionItems) = preProject
+ build-release.cmd = build-release.cmd
+ build.cmd = build.cmd
Ninject.build = Ninject.build
EndProjectSection
EndProject
Added: experiments/ninject2/build-release.cmd
==============================================================================
--- (empty file)
+++ experiments/ninject2/build-release.cmd Mon Feb 16 18:23:13 2009
@@ -0,0 +1,3 @@
+tools\nant\nant.exe
-buildfile:Ninject.build "-D:build.config=release" "-D:build.platform=net-3.5"
package %1 %2 %3 %4 %5 %6 %7 %8
+tools\nant\nant.exe
-buildfile:Ninject.build "-D:build.config=release" "-D:build.platform=silverlight-2.0"
package %1 %2 %3 %4 %5 %6 %7 %8
+tools\nant\nant.exe
-buildfile:Ninject.build "-D:build.config=release" "-D:build.platform=mono-2.0"
package %1 %2 %3 %4 %5 %6 %7 %8
\ No newline at end of file
Copied:
experiments/ninject2/src/Ninject.Tests/Integration/CircularDependenciesTests.cs
(from r142,
/experiments/ninject2/src/Ninject.Tests/Integration/SpecialResolutionTests.cs)
==============================================================================
---
/experiments/ninject2/src/Ninject.Tests/Integration/SpecialResolutionTests.cs
(original)
+++
experiments/ninject2/src/Ninject.Tests/Integration/CircularDependenciesTests.cs
Mon Feb 16 18:23:13 2009
@@ -1,39 +1,88 @@
using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using Ninject.Activation;
+using Ninject.Activation.Hooks;
+using Ninject.Parameters;
using Xunit;
-namespace Ninject.Tests.Integration.SpecialResolutionTests
+namespace Ninject.Tests.Integration.CircularDependenciesTests
{
- public class SpecialResolutionContext
+ public class CircularDependenciesContext
{
protected readonly StandardKernel kernel;
- public SpecialResolutionContext()
+ public CircularDependenciesContext()
{
kernel = new StandardKernel();
}
}
- public class WhenServiceRequestsKernel : SpecialResolutionContext
+ public class WhenDependenciesHaveCircularReferenceBetweenConstructors :
CircularDependenciesContext
{
+ public WhenDependenciesHaveCircularReferenceBetweenConstructors()
+ {
+ kernel.Bind<ConstructorFoo>().ToSelf().InSingletonScope();
+ kernel.Bind<ConstructorBar>().ToSelf().InSingletonScope();
+ }
+
[Fact]
- public void InstanceOfKernelIsInjected()
+ public void DoesNotThrowExceptionIfHookIsCreated()
{
- kernel.Bind<RequestsKernel>().ToSelf();
- var instance = kernel.Get<RequestsKernel>();
+ var request = new Request(typeof(ConstructorFoo), null,
Enumerable.Empty<IParameter>(), null);
+ Assert.DoesNotThrow(() => kernel.Resolve(request));
+ }
- Assert.NotNull(instance);
- Assert.NotNull(instance.Kernel);
- Assert.Same(kernel, instance.Kernel);
+ [Fact]
+ public void ThrowsActivationExceptionWhenHookIsResolved()
+ {
+ Assert.Throws<ActivationException>(() => kernel.Get<ConstructorFoo>());
}
}
- public class RequestsKernel
+ public class WhenDependenciesHaveCircularReferenceBetweenProperties :
CircularDependenciesContext
{
- public IKernel Kernel { get; set; }
+ public WhenDependenciesHaveCircularReferenceBetweenProperties()
+ {
+ kernel.Bind<PropertyFoo>().ToSelf().InSingletonScope();
+ kernel.Bind<PropertyBar>().ToSelf().InSingletonScope();
+ }
+
+ [Fact]
+ public void DoesNotThrowException()
+ {
+ Assert.DoesNotThrow(() => kernel.Get<PropertyFoo>());
+ }
- public RequestsKernel(IKernel kernel)
+ [Fact]
+ public void ScopeIsRespected()
{
- Kernel = kernel;
+ var foo = kernel.Get<PropertyFoo>();
+ var bar = kernel.Get<PropertyBar>();
+
+ Assert.Same(bar, foo.Bar);
+ Assert.Same(foo, bar.Foo);
}
+ }
+
+ public class ConstructorFoo
+ {
+ public ConstructorFoo(ConstructorBar bar) { }
+ }
+
+ public class ConstructorBar
+ {
+ public ConstructorBar(ConstructorFoo foo) { }
+ }
+
+ public class PropertyFoo
+ {
+ [Inject] public PropertyBar Bar { get; set; }
+ }
+
+ public class PropertyBar
+ {
+ [Inject] public PropertyFoo Foo { get; set; }
}
}
Modified: experiments/ninject2/src/Ninject.Tests/Ninject.Tests.csproj
==============================================================================
--- experiments/ninject2/src/Ninject.Tests/Ninject.Tests.csproj (original)
+++ experiments/ninject2/src/Ninject.Tests/Ninject.Tests.csproj Mon Feb 16
18:23:13 2009
@@ -54,6 +54,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ExtensionsForIEnumerable.cs" />
+ <Compile Include="Integration\CircularDependenciesTests.cs" />
<Compile Include="Integration\ThreadScopeTests.cs" />
<Compile Include="Integration\SpecialResolutionTests.cs" />
<Compile Include="Unit\ConstructorInjectorTests.cs" />
@@ -102,4 +103,4 @@
<Target Name="AfterBuild">
</Target>
-->
-</Project>
+</Project>
\ No newline at end of file
Modified:
experiments/ninject2/src/Ninject.Tests/Unit/ConstructorInjectorTests.cs
==============================================================================
--- experiments/ninject2/src/Ninject.Tests/Unit/ConstructorInjectorTests.cs
(original)
+++ experiments/ninject2/src/Ninject.Tests/Unit/ConstructorInjectorTests.cs
Mon Feb 16 18:23:13 2009
@@ -33,14 +33,14 @@
public void CallsConstructor()
{
var sword = new Sword();
- var samurai = injector.Invoke(sword) as Samurai;
+ var samurai = injector.Invoke(new[] { sword }) as Samurai;
Assert.Same(sword, samurai.Weapon);
}
[Fact]
public void CallsConstructorWithNullArgumentIfOneIsSpecified()
{
- var samurai = injector.Invoke((IWeapon)null) as Samurai;
+ var samurai = injector.Invoke(new[] { (IWeapon)null }) as Samurai;
Assert.NotNull(samurai);
}
}
Modified: experiments/ninject2/src/Ninject.Tests/Unit/MethodInjectorTests.cs
==============================================================================
--- experiments/ninject2/src/Ninject.Tests/Unit/MethodInjectorTests.cs
(original)
+++ experiments/ninject2/src/Ninject.Tests/Unit/MethodInjectorTests.cs Mon
Feb 16 18:23:13 2009
@@ -33,7 +33,7 @@
public void CallsMethod()
{
var samurai = new Samurai(new Sword());
- injector.Invoke(samurai, "evildoer");
+ injector.Invoke(samurai, new[] { "evildoer" });
Assert.True(samurai.IsBattleHardened);
}
@@ -41,7 +41,7 @@
public void ReturnsValueFromMethod()
{
var samurai = new Samurai(new Sword());
- var result = injector.Invoke(samurai, "evildoer") as string;
+ var result = injector.Invoke(samurai, new[] { "evildoer" }) as string;
Assert.Equal("Attacked evildoer with a sword", result);
}
}
Modified:
experiments/ninject2/src/Ninject.Tests/Unit/VoidMethodInjectorTests.cs
==============================================================================
--- experiments/ninject2/src/Ninject.Tests/Unit/VoidMethodInjectorTests.cs
(original)
+++ experiments/ninject2/src/Ninject.Tests/Unit/VoidMethodInjectorTests.cs
Mon Feb 16 18:23:13 2009
@@ -33,7 +33,7 @@
public void CallsMethod()
{
var samurai = new Samurai(new Sword());
- injector.Invoke(samurai, "Bob");
+ injector.Invoke(samurai, new[] { "Bob" });
Assert.Equal("Bob", samurai.Name);
}
@@ -42,7 +42,7 @@
{
var samurai = new Samurai(new Sword());
samurai.Name = "Bob";
- injector.Invoke(samurai, (string)null);
+ injector.Invoke(samurai, new[] { (string)null });
Assert.Null(samurai.Name);
}
}
Copied: experiments/ninject2/src/Ninject/Activation/Hooks/ContextHook.cs
(from r144,
/experiments/ninject2/src/Ninject/Activation/Hooks/ContextResolutionHook.cs)
==============================================================================
---
/experiments/ninject2/src/Ninject/Activation/Hooks/ContextResolutionHook.cs
(original)
+++ experiments/ninject2/src/Ninject/Activation/Hooks/ContextHook.cs Mon
Feb 16 18:23:13 2009
@@ -17,6 +17,7 @@
#region Using Directives
using System;
using Ninject.Activation.Caching;
+using Ninject.Planning;
#endregion
namespace Ninject.Activation.Hooks
@@ -24,7 +25,7 @@
/// <summary>
/// A hook that resolves a context.
/// </summary>
- public class ContextResolutionHook : IHook
+ public class ContextHook : IHook
{
/// <summary>
/// Gets the context that will be resolved by the hook.
@@ -32,19 +33,33 @@
public IContext Context { get; private set; }
/// <summary>
- /// Gets or sets the cache.
+ /// Gets or the cache component.
/// </summary>
public ICache Cache { get; private set; }
/// <summary>
- /// Initializes a new instance of the <see
cref="ContextResolutionHook"/> class.
+ /// Gets or the planner component.
+ /// </summary>
+ public IPlanner Planner { get; private set; }
+
+ /// <summary>
+ /// Gets or the planner component.
+ /// </summary>
+ public IPipeline Pipeline { get; private set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ContextHook"/> class.
/// </summary>
/// <param name="context">The context to resolve.</param>
/// <param name="cache">The cache to use to look up instances for
re-use.</param>
- public ContextResolutionHook(IContext context, ICache cache)
+ /// <param name="planner">The planner used to generate activation plans
for instances.</param>
+ /// <param name="pipeline">The pipeline used to activate
instances.</param>
+ public ContextHook(IContext context, ICache cache, IPlanner planner,
IPipeline pipeline)
{
Context = context;
Cache = cache;
+ Planner = planner;
+ Pipeline = pipeline;
}
/// <summary>
@@ -55,6 +70,11 @@
{
lock (Context.Binding)
{
+ if (Context.Request.ActiveBindings.Contains(Context.Binding))
+ throw new ActivationException();
+
+ Context.Request.ActiveBindings.Add(Context.Binding);
+
Context.Instance = Cache.TryGet(Context);
if (Context.Instance != null)
@@ -62,6 +82,13 @@
Context.Instance = Context.GetProvider().Create(Context);
Cache.Remember(Context);
+
+ Context.Request.ActiveBindings.Remove(Context.Binding);
+
+ if (Context.Plan == null)
+ Planner.GetPlan(Context.Instance.GetType());
+
+ Pipeline.Activate(Context);
return Context.Instance;
}
Modified: experiments/ninject2/src/Ninject/Activation/IRequest.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/IRequest.cs (original)
+++ experiments/ninject2/src/Ninject/Activation/IRequest.cs Mon Feb 16
18:23:13 2009
@@ -55,6 +55,12 @@
ICollection<IParameter> Parameters { get; }
/// <summary>
+ /// Gets the collection of bindings which have been activated either by
this request or
+ /// one of its ancestors.
+ /// </summary>
+ ICollection<IBinding> ActiveBindings { get; }
+
+ /// <summary>
/// Determines whether the specified binding satisfies the constraint
defined on this request.
/// </summary>
/// <param name="binding">The binding.</param>
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
Mon Feb 16 18:23:13 2009
@@ -47,23 +47,16 @@
public IPlanner Planner { get; private set; }
/// <summary>
- /// Gets or sets the pipeline component.
- /// </summary>
- public IPipeline Pipeline { get; private set; }
-
- /// <summary>
/// Initializes a new instance of the <see cref="StandardProvider"/>
class.
/// </summary>
/// <param name="type">The type (or prototype) of instances the provider
creates.</param>
/// <param name="injectorFactory">The injector factory component.</param>
/// <param name="planner">The planner component.</param>
- /// <param name="pipeline">The pipeline component.</param>
- public StandardProvider(Type type, IInjectorFactory injectorFactory,
IPlanner planner, IPipeline pipeline)
+ public StandardProvider(Type type, IInjectorFactory injectorFactory,
IPlanner planner)
{
Type = type;
InjectorFactory = injectorFactory;
Planner = planner;
- Pipeline = pipeline;
}
/// <summary>
@@ -73,20 +66,19 @@
/// <returns>The created instance.</returns>
public virtual object Create(IContext context)
{
- context.Plan =
Planner.GetPlan(GetImplementationType(context.Request.Service));
+ if (context.Plan == null)
+ context.Plan =
Planner.GetPlan(GetImplementationType(context.Request.Service));
var directive = context.Plan.GetOne<ConstructorInjectionDirective>();
if (directive == null)
- throw new InvalidOperationException();
+ throw new ActivationException();
var injector = InjectorFactory.GetConstructorInjector(directive.Member);
object[] arguments = directive.Targets.Select(target =>
GetValue(context, target)).ToArray();
context.Instance = injector.Invoke(arguments);
- Pipeline.Activate(context);
-
return context.Instance;
}
@@ -123,8 +115,7 @@
{
return ctx => new StandardProvider(prototype,
ctx.Kernel.Components.Get<IInjectorFactory>(),
- ctx.Kernel.Components.Get<IPlanner>(),
- ctx.Kernel.Components.Get<IPipeline>());
+ ctx.Kernel.Components.Get<IPlanner>());
}
}
}
Modified: experiments/ninject2/src/Ninject/Activation/Request.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Activation/Request.cs (original)
+++ experiments/ninject2/src/Ninject/Activation/Request.cs Mon Feb 16
18:23:13 2009
@@ -33,32 +33,38 @@
/// <summary>
/// Gets the service that was requested.
/// </summary>
- public Type Service { get; set; }
+ public Type Service { get; private set; }
/// <summary>
/// Gets the parent request.
/// </summary>
- public IRequest Parent { get; set; }
+ public IRequest Parent { get; private set; }
/// <summary>
/// Gets the target that will receive the injection, if any.
/// </summary>
- public ITarget Target { get; set; }
+ public ITarget Target { get; private set; }
/// <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>
- public Func<IBindingMetadata, bool> Constraint { get; set; }
+ public Func<IBindingMetadata, bool> Constraint { get; private set; }
/// <summary>
/// Gets the parameters that affect the resolution.
/// </summary>
- public ICollection<IParameter> Parameters { get; set; }
+ public ICollection<IParameter> Parameters { get; private set; }
/// <summary>
- /// Gets or sets the callback that resolves the scope for the request,
if an external scope was provided.
+ /// Gets the collection of bindings which have been activated either by
this request or
+ /// one of its ancestors.
/// </summary>
- public Func<object> ScopeCallback { get; set; }
+ public ICollection<IBinding> ActiveBindings { get; private set; }
+
+ /// <summary>
+ /// Gets the callback that resolves the scope for the request, if an
external scope was provided.
+ /// </summary>
+ public Func<object> ScopeCallback { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="Request"/> class.
@@ -72,6 +78,7 @@
Service = service;
Constraint = constraint;
Parameters = parameters == null ? new List<IParameter>() :
parameters.ToList();
+ ActiveBindings = new List<IBinding>();
ScopeCallback = scopeCallback;
}
@@ -89,6 +96,7 @@
Target = target;
Constraint = target.Constraint;
Parameters = new List<IParameter>();
+ ActiveBindings = new List<IBinding>(parent.ActiveBindings);
ScopeCallback = scopeCallback;
}
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
Mon Feb 16 18:23:13 2009
@@ -39,7 +39,7 @@
/// </summary>
/// <param name="values">The values to inject.</param>
/// <returns>The object created by the constructor.</returns>
- public object Invoke(params object[] values)
+ public object Invoke(object[] values)
{
return Callback.Invoke(values);
}
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
Mon Feb 16 18:23:13 2009
@@ -41,7 +41,7 @@
/// <param name="target">The target object on which to call the
method.</param>
/// <param name="values">The values to inject.</param>
/// <returns>The return value of the method, or <see langword="null"/>
if the method returns <see type="void"/>.</returns>
- public abstract object Invoke(object target, params object[] values);
+ public abstract object Invoke(object target, object[] values);
/// <summary>
/// Builds the expression tree that can be compiled into a delegate,
which in turn
Modified: experiments/ninject2/src/Ninject/KernelBase.cs
==============================================================================
--- experiments/ninject2/src/Ninject/KernelBase.cs (original)
+++ experiments/ninject2/src/Ninject/KernelBase.cs Mon Feb 16 18:23:13 2009
@@ -30,6 +30,7 @@
using Ninject.Infrastructure.Language;
using Ninject.Modules;
using Ninject.Parameters;
+using Ninject.Planning;
using Ninject.Planning.Bindings;
using Ninject.Syntax;
#endregion
@@ -347,7 +348,7 @@
/// <returns>The created hook.</returns>
protected virtual IHook CreateHook(IContext context)
{
- return new ContextResolutionHook(context, Components.Get<ICache>());
+ return new ContextHook(context, Components.Get<ICache>(),
Components.Get<IPlanner>(), Components.Get<IPipeline>());
}
object IServiceProvider.GetService(Type serviceType)
Modified: experiments/ninject2/src/Ninject/Modules/IModuleLoader.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Modules/IModuleLoader.cs (original)
+++ experiments/ninject2/src/Ninject/Modules/IModuleLoader.cs Mon Feb 16
18:23:13 2009
@@ -1,3 +1,4 @@
+#if !SILVERLIGHT
#region License
// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
@@ -49,4 +50,5 @@
/// <param name="recursive">If <c>true</c>, scan all subdirectories of
the path as well.</param>
void ScanAndLoadModules(string path, IEnumerable<string> patterns, bool
recursive);
}
-}
\ No newline at end of file
+}
+#endif //!SILVERLIGHT
\ No newline at end of file
Modified: experiments/ninject2/src/Ninject/Modules/ModuleLoader.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Modules/ModuleLoader.cs (original)
+++ experiments/ninject2/src/Ninject/Modules/ModuleLoader.cs Mon Feb 16
18:23:13 2009
@@ -1,4 +1,5 @@
-#region License
+#if !SILVERLIGHT
+#region License
// Author: Nate Kohari <
na...@enkari.com>
// Copyright (c) 2007-2009, Enkari, Ltd.
//
@@ -158,4 +159,5 @@
false);
}
}
-}
\ No newline at end of file
+}
+#endif //!SILVERLIGHT
\ No newline at end of file
Modified: experiments/ninject2/src/Ninject/Ninject.csproj
==============================================================================
--- experiments/ninject2/src/Ninject/Ninject.csproj (original)
+++ experiments/ninject2/src/Ninject/Ninject.csproj Mon Feb 16 18:23:13 2009
@@ -70,7 +70,7 @@
<Compile Include="Activation\Context.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Activation\Hooks\ContextResolutionHook.cs" />
+ <Compile Include="Activation\Hooks\ContextHook.cs" />
<Compile Include="Activation\Hooks\IHook.cs" />
<Compile Include="Activation\Request.cs" />
<Compile Include="Activation\IContext.cs">
Modified: experiments/ninject2/src/Ninject/StandardKernel.cs
==============================================================================
--- experiments/ninject2/src/Ninject/StandardKernel.cs (original)
+++ experiments/ninject2/src/Ninject/StandardKernel.cs Mon Feb 16 18:23:13
2009
@@ -75,7 +75,10 @@
Components.Add<IMethodInjectionHeuristic,
StandardMethodInjectionHeuristic>();
Components.Add<IInjectorFactory, InjectorFactory>();
+
+ #if !SILVERLIGHT
Components.Add<IModuleLoader, ModuleLoader>();
+ #endif
}
}
}
Modified: experiments/ninject2/src/Ninject/Syntax/ModuleLoadExtensions.cs
==============================================================================
--- experiments/ninject2/src/Ninject/Syntax/ModuleLoadExtensions.cs
(original)
+++ experiments/ninject2/src/Ninject/Syntax/ModuleLoadExtensions.cs Mon Feb
16 18:23:13 2009
@@ -60,6 +60,7 @@
kernel.UnloadModule(typeof(TModule));
}
+ #if !SILVERLIGHT
/// <summary>
/// Scans the application's base directory for assemblies, and if they
have loadable modules, loads them.
/// </summary>
@@ -147,5 +148,6 @@
{
return kernel.Components.Get<IModuleLoader>();
}
+ #endif //!SILVERLIGHT
}
}
Modified: experiments/ninject2/src/SharedAssemblyInfo.cs
==============================================================================
--- experiments/ninject2/src/SharedAssemblyInfo.cs (original)
+++ experiments/ninject2/src/SharedAssemblyInfo.cs Mon Feb 16 18:23:13 2009
@@ -15,7 +15,7 @@
[assembly: AssemblyProductAttribute("Ninject: Lightweight dependency
injection for .NET")]
[assembly: AssemblyCompanyAttribute("Enkari, Ltd.")]
[assembly: AssemblyCopyrightAttribute("Copyright � 2007-2009 Enkari, Ltd.
and contributors")]
-[assembly: AssemblyVersionAttribute("2.0.0.133")]
+[assembly: AssemblyVersionAttribute("2.0.0.142")]
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(true)]