我有一个非常简单的列表,我用Structuremaps ObjectFactory.GetAllInstances()实例化。
private List<UserReleaseTime> _UserReleaseTimes =
ObjectFactory.GetAllInstances<UserReleaseTime>().ToList()
UserReleaseTime如下所示:
public class UserReleaseTime
{
public string name { get; set; }
public double totalReleaseTime { get; set; }
public double withinReleaseHours { get; set; }
public double outsideReleaseHours { get; set; }
}
创建集合后,似乎structmap添加了一个空值或空值的对象。反正有没有阻止这种情况发生?
更新 UserReleaseTime在Structuremap中注册,如下所示:
For<UserReleaseTime>().Use<UserReleaseTime>();