RavenDB changes metadata “Raven-Entity-Name”

前端 未结 1 1898
闹比i
闹比i 2021-01-05 19:47

I noticed that when I add a document to RavenDB and see the \"Raven-Entity-Name\" metadata it makes it plural. E.g. if my model name was Product it changes it t

相关标签:
1条回答
  • 2021-01-05 20:39

    It's part of the philosophy of RavenDB to do convention over configuration, so it does this by default.

    But you can override it if you want to, you can do something like this:

    _documentStore = new DocumentStore { Url = "http://localhost:8080/" };
    _documentStore.Conventions.FindTypeTagName = t =>
    {
        if (t.Name == "MyClass")
            return "MyClassBlahBlah";
        else
            return Raven.Client.Util.Inflector.Pluralize(t.Name); 
    };
    
    _documentStore.Initialize(); 
    

    See this thread on the RavenDB discussion group for more info

    0 讨论(0)
提交回复
热议问题