Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用 MongoDB 深度克隆对象?在 C# 中像:
Object1 _object2 = new Object1(); BsonValue _bsonValue = _object2.ToBsonDocument().DeepClone() //now _bsonValue to "Object1" - how to?
如何将“_bsonValue”转换回“Object1”类?这并不是真正用于将对象保存到 MongoDB,只是深度克隆对象并在其他地方使用该对象
使用 ToBsonDocument() 将 _bsonValue 转换回 BsonDocument,然后由您将其转换回您的类。