Ninject は良さそうなので、自分のプロジェクトで使用したいと思います。残念ながら、私はまだ最も些細なバインディングを行うのに苦労しています。[Inject] 属性は問題なくコンパイルされますが、コンパイラは「Bind」コマンドを見つけることができません。
using System;
using Ninject.Core;
using Ninject.Core.Binding;
namespace NinjectTest
{
public interface IFoo
{
void DoSomething();
}
public class Foo : IFoo
{
public void DoSomething()
{
throw new NotImplementedException();
}
}
public class Bar
{
[Inject] private IFoo theFoo;
public Bar()
{
Bind<IFoo>().To<Foo>(); //Compiler Error: "The name 'Bind' does not exist in the current context"
}
}
}
ここで何がうまくいかないのでしょうか?