So lets say I have 3 objects Fruit, Apple and Orange. Fruit is the abstract base class for Apple and Orange. When I use session.Store(myApple), it puts it into the Apples collection. myOrange stores in the Oranges collection. Makes sense.
Can I tell Raven that I want a Fruits collection that could hold Apples or Oranges? Mongodb allows this since it lets me explicitly specify the collection name. The RavenDB collections documentation says:
The expected usage pattern is that collections are used to group
documents with similar structure, although that is not required. From
the database standpoint, a collection is just a group of documents
that share the same entity name.
I’d expect it to be something like: session.Store<Fruit>(myApple), or session.Store(“Fruits”, myApple)
Any ideas? Thanks.
Awl,
You can do it using:
That is the long way to do so.
A much better way would be to add this logic globally, it looks something like this:
That will handle this for everything.