c# - Lazy<> Ninject Injection -
i use ninject framework. in code have lazy object. can create instance, when call value property got exception.
private lazy<ipsoriasisreportusercontrol> psoriasisreportusercontrol; [inject] public lazy<ipsoriasisreportusercontrol> psoriasisreportusercontrol { { return psoriasisreportusercontrol; } set { psoriasisreportusercontrol = value; } }
i got
the lazily-initialized type not have public, parameterless constructor
exception because injection not inject method constructor. think have write method bind creates new instance.
use factory extension ninject https://github.com/ninject/ninject.extensions.factory
Comments
Post a Comment