我在向ImageService构造函数添加值时遇到问题 我的IUserRepository工作,但是当我尝试将“absoluteImagePath”放入构造函数(Bootstrapper)时,我收到以下错误:
StructureMap.StructureMapException: StructureMap Exception Code: 205 Missing requested Instance property "absoluteImagePath" for InstanceKey "8a15766b-879b-4edb-b060-c868f35aef39
ImageService:
public ImageService(IUserRepository userRepository, string absoluteImagePath)
{
_userRepository = userRepository;
_absoluteImagePath = absoluteImagePath;
}
引导程序:
For<IImageService>()
.Use<ImageService>()
.Ctor<string>("absoluteImagePath")
.EqualToAppSetting("AbsoluteImagePath");