I have a post class which may contain product class as a property.
The product class “id” property never gets set, while “stock_quantity” does.
[BsonIgnoreExtraElements]
public class Post {
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string _Id { get; set; }
[BsonElement("ID")]
public int Id {get;set;}
[BsonElement("post_name")]
public string Slug {get;set;}
[BsonElement("product")]
public Product.Product Product {get;set;}
}
[BsonIgnoreExtraElements]
public class Product {
[BsonElement("id")]
public int id {
get;
set;
}
[BsonElement("stock_quantity")]
public int StockQuantity {
get;
set;
}
}