I recently played with RavenDB and something annoyed me.
I have an object object with a series of value objects, for example.
class Foo { IList<Bar> Bars { get; set; } }
There are several times when I want to pass an object of type Bar to a method / class, but at some point I want to refer to the parent object. In the world of NHibernate, it is very simple if I configure it with a ratio of 1 .. *, for example.
class Bar { Foo Foo { get; set; } }
However, RavenDb does not really like it, which leads to the fact that I have to create methods such as:
void DoSomething(Foo foo, Bar bar) { Console.WriteLine(foo); Console.WriteLine(bar); }
but not
void DoSomething(Bar bar) { Console.WriteLine(bar.Foo); Console.WriteLine(bar); }
Is there any way to achieve this with RavenDb?
I understand that RavenDb (and document databases in general) contribute to different thinking about working with entities, if this is just the case when I spend too long in a relational / normalized world, can someone explain how I should structure my code in another db document?
source share