You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Motivation
----------
Provide a method of controlling the keys for documents using an easy POCO
approach, but with customizability for more advanced use cases.
Modifications
-------------
For the default use case, move from a single KeyAttribute property on the
document to supporting multiple KeyAttribute properties. Then concatenate
their values together, separated by a "-". Control their order with
KeyOrderAttribute.
An example use case would be documents whose keys are built as a
combination of the Type property (i.e. "beer") and a unique id such as an
auto-increment or a GUID (i.e. a Number property with the value "1"). By
putting a Key and KeyOrder attribute on each property, the generator will
give it the key "beer-1".
This also works well for simple keys read from a single property. If you
only place the Key attribute on one property, its value is used directly.
For more advanced use cases, the DocIdGenerator property may be applied to
a document. This takes a type that implements IDocIdGenerator, which
allows for any kind of custom key building.
Notes
-----
The limitation of this approach is that it assumes that the document ID
generator will always generate the same key the document had when it was
read via LINQ. The advantage is that it easily supports creating new
documents, since it will generate the new key from the document the same
way for new or existing documents. This makes designing an object model
with consistent keys easy.
No description provided.
The text was updated successfully, but these errors were encountered: