ravendb4

How to Load<T> a RavenDB Document, constrained to a Collection, when not using default ID generation strategy

核能气质少年 提交于 2019-12-11 00:31:52
问题 In RavenDB 4 (v4.0.3-patch-40031) I have two Document types: Apple and Orange . Both have similar, but also distinct, properties. I run into a bug in my code at runtime where sometimes an the ID of an Apple is provided, but an Orange is returned. Scary! Diving into it, it somewhat makes sense. But I'm struggling with an appropriate solution. Here goes. In RavenDB, I have stored a single Apple as a Document: id: "078ff39b-da50-4405-9615-86b0d185ba17" { "Name": "Elstar", "@metadata": { "