我正在通过RthinkDB.Driver https://github.com/bchavez/RethinkDb.Driver在C#中使用Rethink DB。
我知道在关系数据库中,有一个功能可以在一个文档中创建对另一个文档的引用。在mongodb中,它是ObjectID;在LiteDB中,它是BsonRef属性或Dbref函数。LiteDB示例:
public class Order
{
public int OrderId { get; set; }
[BsonRef("customers")] // where "customers" are Customer collection name
public Customer Customer { get; set; }
}
问题是,如何声明对象对另一个表的引用?我读了这篇文章https://rethinkdb.com/docs/data-modeling/#linking-documents-in-multiple-tables,但没有示例如何插入带参考的文档。
c#驱动程序不会公开您的类的注释。 RethinkDB仅存储可以通过关系查询的json文档。考虑写一点ORM,或注释您的类属性。