使用RavenDB处理与T[]而不是T的文档关系
RavenDB文档展示了如何使用包含处理文档关系使用RavenDB处理与T[]而不是T的文档关系,ravendb,Ravendb,RavenDB文档展示了如何使用包含处理文档关系 public class Order { public Product[] Items { get; set; } public string CustomerId { get; set; } public double TotalPrice { get; set; } } public class Product { public string Id { get; set; }
public class Order
{
public Product[] Items { get; set; }
public string CustomerId { get; set; }
public double TotalPrice { get; set; }
}
public class Product
{
public string Id { get; set; }
public string Name { get; set; }
public string[] Images { get; set; }
public double Price { get; set; }
}
public class Customer
{
public string Name { get; set; }
public string Address { get; set; }
public short Age { get; set; }
public string HashedPassword { get; set; }
}
如果我不想使用Includes/Live Projections,而是使用产品列表来包括客户,我将如何处理Includes或Live Projections:
public class Order
{
public string[] ItemIds { get; set; }
public string CustomerId { get; set; }
public double TotalPrice { get; set; }
}
如果我理解你的要求,这应该会有帮助。我在这里写了一篇博客:
这有帮助吗?如果我理解你的要求,这应该会有帮助。我在这里写了一篇博客:
这有用吗?谢谢,这就是我一直在寻找的。然而,这在性能方面表现如何?我没有确切的数字,但它表现良好。因为您在一个会话中检索所有内容,因此只需访问数据库一次,所以速度很快。我很幸运,在不到一秒的时间里,我不需要数千份文档,但据我所知,Raven在这一领域确实很出色。但愿我能给你一个硬数字……谢谢,这就是我一直在寻找的。然而,这在性能方面表现如何?我没有确切的数字,但它表现良好。因为您在一个会话中检索所有内容,因此只需访问数据库一次,所以速度很快。我很幸运,在不到一秒的时间里,我不需要数千份文档,但据我所知,Raven在这一领域确实很出色。希望我能给你一个硬数字。。。