Exemplo n.º 1
0
        /// <summary>
        /// Creates a new IndexBatch for deleting a batch of documents.
        /// </summary>
        /// <param name="keyName">The name of the key field that uniquely identifies documents in the index.</param>
        /// <param name="keyValues">The keys of the documents to delete.</param>
        /// <returns>A new IndexBatch.</returns>
        public static IndexBatch Delete(string keyName, IEnumerable <string> keyValues)
        {
            Throw.IfArgumentNull(keyName, "keyName");
            Throw.IfArgumentNull(keyValues, "keyValues");

            return(IndexBatch.New(keyValues.Select(v => IndexAction.Delete(keyName, v))));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new IndexBatch for merging documents into existing documents in the index.
        /// </summary>
        /// <typeparam name="T">
        /// The CLR type that maps to the index schema. Instances of this type can be stored as documents in the index.
        /// </typeparam>
        /// <param name="documents">The documents to merge; Set only the properties that you want to change.</param>
        /// <returns>A new IndexBatch.</returns>
        /// <remarks>
        /// If type T contains non-nullable value-typed properties, these properties may not merge correctly. If you
        /// do not set such a property, it will automatically take its default value (for example, 0 for int or false
        /// for bool), which will override the value of the property currently stored in the index, even if this was
        /// not your intent. For this reason, it is strongly recommended that you always declare value-typed
        /// properties to be nullable in type T.
        /// </remarks>
        public static IndexBatch <T> Merge <T>(IEnumerable <T> documents) where T : class
        {
            Throw.IfArgumentNull(documents, "documents");

            return(IndexBatch.New(documents.Select(d => IndexAction.Merge(d))));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a new IndexBatch for merging documents into existing documents in the index.
        /// </summary>
        /// <param name="documents">The documents to merge; Set only the fields that you want to change.</param>
        /// <returns>A new IndexBatch.</returns>
        public static IndexBatch Merge(IEnumerable <Document> documents)
        {
            Throw.IfArgumentNull(documents, "documents");

            return(IndexBatch.New(documents.Select(d => IndexAction.Merge(d))));
        }