MongoDb c#使用bsonextraelements映射递归对象

MongoDb c#使用bsonextraelements映射递归对象,c#,mongodb,mongodb-.net-driver,C#,Mongodb,Mongodb .net Driver,我有以下课程: public class Property { public string Description { get; set; } public object Value { get; set; } [BsonExtraElements] public IDictionary<string, Property> OtherData { get; set; } } public class Device { public str

我有以下课程:

public class Property
{ 
    public string Description { get; set; }
    public object Value { get; set; }

    [BsonExtraElements]
    public IDictionary<string, Property> OtherData { get; set; }
} 

public class Device
{
   public string DeviceId { get; set; }
   public IDictionary<string, Property> Properties { get; set; }
}
所以,正如您所看到的,我希望以递归的方式映射具体的模型“属性”,并使用ExtraElements。但上面的代码将失败,因为BsonExtraElements只能用于IDicionary接口。 此外:

公共类属性:IDictionary
{ 
公共字符串说明{get;set;}
公共对象值{get;set;}
}
不起作用。老实说,这种语义将是最理想的。(无需访问其他数据的额外属性) 但这两种语义我都无法正确映射。 以前有人尝试过类似的东西吗?如何实现这一点有什么提示吗

{  
   "DeviceId":"asd",
   "Properties":{  
      "PropertyA":{  
         "Description":"some info",
         "PropertyAB":{  
            "Description":"some info",
            "Value":"etc"
         }
      },
      "PropertyB":{  
         "Description":"some info",
         "Value":"etc"
      }
   }
}
public class Property : IDictionary<string, Property>
{ 
    public string Description { get; set; }
    public object Value { get; set; }
}