[CSHARP-232] Create DBRefs with conventions Created: 27/May/11  Updated: 20/Mar/14  Resolved: 04/May/12

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.0
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: Jon Eckstein Assignee: Robert Stam
Resolution: Won't Fix Votes: 0
Labels: dbref
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CSHARP-197 Proxy attribute on properties? Closed

 Description   

Instead of polluting your model with MongoDB specific classes like MongoDBRef, you should be able to handle it via conventions. For example,
If I have a model class with a foreign key reference like the following:
public class Employee{
public object Id;
public object Manager_Id;
}

I can create a convention where "Manager" is the collection name and "Id" is the field to join on. When a save occurs, the driver can detect this convention and apply the $ref appropriately.



 Comments   
Comment by Craig Wilson [ 04/May/12 ]

Jon,
Doing this would require us to either 1) automatically follow the reference and issue another query or 2) create a lazy-loaded proxy. 1) is essentially a performance killer and completely unexpected. Therefore we will not do this. 2) would require some proxy-generation which adds a complexity level unequal to the amount of use the feature would receive.
You could implement this feature yourself by implementing a custom IBsonSerializer if you feel it is necessary.

Craig

Comment by Craig Wilson [ 04/May/12 ]

Effectively the same request.

Generated at Wed Feb 07 21:36:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.