In some cases it can be advantageous to group several properties under a nested document in the serialized form.
For example, the class:
public class OrderItem { public int OrderId { get; set; } public int ProductId { get; set; } public int Quantity { get; set; } }
might need to be serialized as:
{ _id : { OrderId : 1, ProductId : 2 }, Quantity : 3 }
While this serialization format could also be achieved by declaring a custom POCO to hold the OrderId/ProductId pair, there are cases where we might want the components of a compound primary key to appear at the top level in the POCO while being grouped together in a nested `_id` element in the serialized form.
- is depended on by
-
EF-35 Composite key reading
- Closed
-
EF-36 Query against composite key components
- Closed
- related to
-
CSHARP-4758 Modify BsonClassMapSerializer to handle properties that are grouped in a nested document
- Backlog