Я объявил свои привязки Ninject в модуле NinjectModule следующим образом:
public override void Load()
{
Bind<ISessionFactory>().ToMethod(c => SessionFactory1.SessionFactory).InSingletonScope().Named("d1");
Bind<ISessionFactory>().ToMethod(c => SessionFactory2.SessionFactory).InSingletonScope().Named("d2");
Bind<ISession>().ToMethod(c => c.Kernel.Get<ISessionFactory>("d1").OpenSession()).Named("d1");
Bind<ISession>().ToMethod(c => c.Kernel.Get<ISessionFactory>("d2").OpenSession()).Named("d2");
Bind(typeof(IReadOnlyRepository<,>)).To(typeof(Repository<,>)).Named("d1").WithConstructorArgument("session", c => c.Kernel.Get<ISession>("d1"));
Bind(typeof(IReadOnlyRepository<,>)).To(typeof(Repository<,>)).Named("d2").WithConstructorArgument("session", c => c.Kernel.Get<ISession>("d2"));
}
Если запустить для разрешения IReadonlyRepository, я получаю исключение от Ninject (ActivationException: Ошибка при активации репозитория {ulong, Workflow}), может кто-нибудь обнаружить ошибку в моей конфигурации привязки?
IReadOnlyRepository repository1 = kernel.Get<Repository<UInt64, Workflow>>("d1");