Persisting circular dependent C# classes in mongodb

In a grails application, the following structure is completely supported and persisted on mongodb (using mongodb plugin):

class Person {
    String name

    static hasMany = [pets: Pet]

class Pet {
    String name
    Person owner

The relation is traverse-able in both ways. I need to implement the exact same structure in C# (using mongodb official driver for C#). How is it possible to have both sides reachable from the other side. In C#, circular dependencies are not serializable and I could not find any alternative way.


Change child side to using an ObjectID ref to owner and make a custom transient getter getOwner() that fetches the owner based on the owner_id. Very easy to do in grails, should facilitate easy serialization in c#.

Need Your Help

How to determine if a specific event log exists WITHOUT using .NET Framework in VC++?

c++ winapi event-log

I wonder if there is any WinAPI that can replace the following function EventLog::Exists() and EventLog::CreateEventSource() so my code won't rely on the .NET Framework.

When to use Mockito.verify()

java unit-testing junit mockito guidelines

I write JUnit test cases for 3 purposes:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.