我正在尝试下一条规则:
var result = new AutoFaker<MyModel>().RuleFor(x => x.AnotherModel, null).Generate();
public class MyModel
{
public string Test { get; set; }
public AnotherModel AnotherModel { get; set; }
}
public class AnotherModel
{
public string Test1 { get; set; }
}
得到消息:
Severity Code Description Project File Line Suppression State
Error CS0121 The call is ambiguous between the following methods or properties:
'Faker<T>.RuleFor<TProperty>(Expression<Func<T, TProperty>>, Func<Faker, T, TProperty>)'
and 'Faker<T>.RuleFor<TProperty>(Expression<Func<T, TProperty>>, TProperty)'
为什么我不能将 null 分配给该模型?