0
简单的问题,你怎么一个BsonValue的默认值设置为空列表BsonDefaultValue设置为空列表
[BsonElement("Networks")]
[BsonRepresentation(BsonType.String)]
[BsonIgnoreIfNull]
[BsonDefaultValue(new List<SocialProfileTypes>() { })]
[BsonIgnoreIfDefault]
public UniqueList<SocialProfileTypes> Networks
{
get { return networks; }
set { networks = value; }
}
由于[BsonDefaultValue(new List<SocialProfileTypes>() { })]
给出了一个语法错误
Error 8 An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
抱歉,关于唯一列表中的混淆我想将该部分抽象出来,因此我将其替换为列表。唯一列表是列表中的直接后代,因此它应该可以工作。我会尝试一下 – MrX 2014-10-31 12:54:29