How come there's no IKernel implementation in Ninject.Portable

孤街浪徒 提交于 2019-12-21 17:29:47

问题


I use and fancy Ninject alot.

I wonder why there is no "BasicKernel" in Ninject.Portable?

Is implementing IKernel require any call that PCLs don't contain?

I'm talking about simple scenario (about: Bind<If1>().To<Class1>() and Get<If1>() )?


回答1:


The PCL version of Ninject is split into two libraries, Ninject.dll and Ninject.Common.dll as some of the code is platform-specific. Ninject cannot exist without its platform code.

In order to use Ninject, you need to add the Portable.Ninject Nuget to both your portable library and to your main app/exe. Adding the package into the main app/exe is what brings in both required files.

As an aside, I'm reworking the package to use the PCL "Bait and Switch" technique, so there's only a single Ninject.dll file. That'll enable you to reference any of it within a PCL, but still requires the NuGet to be referenced by the app/exe to get the "real" implementation instead of a façade.



来源:https://stackoverflow.com/questions/24757186/how-come-theres-no-ikernel-implementation-in-ninject-portable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!