You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 5.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Session: How to customize collection assignment for entities?

Entities are grouped into collections on the server side. In order to determine the collection name that an entity belongs to there are special conventions which return the collection name based on the type of an entity: FindTypeTagName and FindDynamicTagName.


By default a collection name is pluralized form of a name of an entity type. For example objects which type is Category will belong to Categories collection. However if your intention is to classify them as ProductGroups use the following code:

store.Conventions.FindTypeTagName = type =>
	if (typeof(Category).IsAssignableFrom(type))
		return "ProductGroups";
	return DocumentConvention.DefaultTypeTagName(type);