-1
这可能是一个愚蠢的问题,但我正在关注这个导师here。试图使用Ninject模块
然后,我有,当我使用Ninject
名称“绑定”这下面的错误不存在。
发生了什么事?
using Ninject.Modules;
using Ninject;
namespace WCFExampleLibrary.Services
{
public class IocServices : NinjectModule
{
public override void Load()
{
Bind<ICourseRepository>().To<CourseRepository>();
Bind<IStudentRepository>().To<StudentRepository>();
Bind<IEnrollementRepository>().To<EnrollementRepository>();
}
}
}
using System.Reflection;
using Ninject;
namespace WCFExampleLibrary.Services
{
public static class FactoryBuilder
{
private static IKernel _Kernal { get; set; }
public static T GetServices<T>()
{
_Kernal = new StandardKernel();
_Kernal.Load(Assembly.GetExecutingAssembly());
return _Kernal.Get<T>();
}
}
}
你是如何使用它?需要看到更多的代码。 –