Objects

Creates documents from a set of objects. Any input documents will be ignored. The objects can be anything, and the collection can be heterogenous. Dictionary<string, object> will be handled natively and each key-value pair will be added to the output document metdata. Anything else will be reflected and turned into a Dictionary<string, object> with metadata for each property.

Usage

  • Objects(IEnumerable<Object> objects)

    Creates documents from the specified objects.

    • objects

      The objects to create documents for.

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • AddKeyConversion(string originalKeyName, string newKeyName)

    Allows renaming of keys during document creation: "If you find key X, create it as key Y instead."

    • originalKeyName

      The name of the original key to convert.

    • newKeyName

      The name you want to convert the key to.

  • ExcludeKeys(params string[] keys)

    Allows creation of a list of keys to discard.

    • keys

      The keys to discard.

  • IncludeKeys(params string[] keys)

    Allows creation of a list of keys to keep. If this list any members, any keys other than those in this list will be discarded.

    • keys

      The keys to keep.

  • WithContentKey(string contentKey)

    Specifies which metakey should be used for the document content

    • contentKey

      The name of the content property.

  • WithLimit(int limit)

    Limits the number of created documents.

    • limit

      The number of objects to create documents from.

GitHub