我想在我的 CSV 输出中包含来自子类的值。子类包含几个指示可用操作的布尔值。
public class AllowedActions {
public bool CanCheckIn { get; set; }
public bool CanCheckOut { get; set; }
}
public class ContentItem {
public AllowedActions Actions { get; set; }
public Guid? ContentTypeId { get; set; }
}
我可以创建一个包含 ContentItem 属性和 AllowedAction 类的值的类映射吗?将它们添加到地图会导致“未为类型 'XYZ.ContentItem' 定义属性 'Boolean CanCheckIn'”错误。
这不起作用:
Map(m => m.Actions.CanCheckIn);
Map(m => m.Actions.CanCheckOut);