예제 #1
0
        public IndexResult Update <TSource>(DocumentId id, UpdateRequestBody requestBody, LanguageRouting languageRouting, Action <UpdateCommand> commandAction)
        {
            UpdateCommand <TSource> updateCommand = this.commands.Update <TSource>((IndexName)this.DefaultIndex, (TypeName)this.GetTypeName <TSource>(), id);

            if (languageRouting.IsNotNull() && languageRouting.IsValid())
            {
                updateCommand.LanguageRouting = this.GetSupportedLanguageRoutingOrDefault(languageRouting);
            }
            updateCommand.Body = requestBody.Clone();
            this.PrepareSerializerUsingConventions(updateCommand.CommandContext.Serializer);
            return(updateCommand.Execute());
        }
예제 #2
0
        public DeleteResult Delete(Type type, DocumentId id, LanguageRouting languageRouting, Action <DeleteCommand> commandAction)
        {
            DeleteCommand deleteCommand = this.commands.Delete(this.DefaultIndex, this.GetTypeName(type), (string)id);

            if (languageRouting.IsNotNull() && languageRouting.IsValid())
            {
                deleteCommand.LanguageRouting = this.GetSupportedLanguageRoutingOrDefault(languageRouting);
            }
            if (commandAction.IsNotNull())
            {
                commandAction(deleteCommand);
            }
            return(deleteCommand.Execute());
        }