Example #1
0
        public async void InnerExecuteUpdate()
        {
            Owner.Executing = true;
            try
            {
                var result = await Owner.Service.UpdateAsync(Owner.Database, Owner.Collection, UpdateFilter.Deserialize <BsonDocument>(Constants.UpdateFilterProperty), UpdateDocument.Deserialize <BsonDocument>(Constants.UpdateDocumentProperty), UpdateMulti, Owner.Cts.Token);

                Owner.RawResult  = result.ToJson(Options.JsonWriterSettings);
                Owner.RawResult += Environment.NewLine;
                Owner.RawResult += Environment.NewLine;
                Owner.RawResult += "Modified Count: " + result.ModifiedCount;

                Owner.SelectedViewIndex = 1;
                Owner.Root = null;
            }
            catch (BsonExtensions.BsonParseException ex)
            {
                LoggerHelper.Logger.Error("Exception while executing Update command", ex);
                Owner.SelectedViewIndex = 1;
                Owner.RawResult         = ex.Message;
                Owner.Root = null;
                Messenger.Default.Send(new NotificationMessage <BsonExtensions.BsonParseException>(this, ex, Constants.UpdateParseException));
            }
            catch (Exception ex)
            {
                LoggerHelper.Logger.Error("Exception while executing Update command", ex);
                Owner.RawResult         = ex.Message;
                Owner.SelectedViewIndex = 1;
                Owner.Root = null;
            }
            finally
            {
                Owner.Executing = false;
                Owner.ShowPager = false;
            }
        }