开发者

HasMany: Empty list instead of null

I am using CastleProject ActiveRecord. I have the following property in my class:

[HasMany(typeof(Order), Table = "Orders", ColumnKey = "OrderId")]
internal IList<Order> Orders
{
  get;
  set;
}

In case Orders table does not contain any orders, Orders property is null. Can I somehow point ActiveRecord that it should create empty list instead of returning null, without giving up autoprope开发者_StackOverflow中文版rty?


Not exactly what you want, but couldn't you instantiate an empty list in the constructor:

public MyClass()
{
  Orders = new List<Order>();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜