/// <summary>
 /// To Bson
 /// </summary>
 public static BsonDocument ToBson(CommandHandlerRecord record)
 {
     return new BsonDocument()
     {
         { "HandlerId", record.HandlerId ?? "" },
         { "CommandId", record.CommandId ?? "" },
         { "StartedDate", record.StartedDate },
         { "EndedDate", record.EndedDate },
         { "TypeName", record.TypeName ?? "" },
         { "ErrorMessage", record.ErrorMessage ?? "" },
         { "ErrorStackTrace", record.ErrorStackTrace ?? ""},
     };
 }
 /// <summary>
 /// To Bson
 /// </summary>
 public static BsonDocument ToBson(CommandHandlerRecord record)
 {
     return(new BsonDocument()
     {
         { "HandlerId", record.HandlerId ?? "" },
         { "CommandId", record.CommandId ?? "" },
         { "StartedDate", record.StartedDate },
         { "EndedDate", record.EndedDate },
         { "TypeName", record.TypeName ?? "" },
         { "ErrorMessage", record.ErrorMessage ?? "" },
         { "ErrorStackTrace", record.ErrorStackTrace ?? "" },
     });
 }
Ejemplo n.º 3
0
 public void LogCommandHandler(CommandHandlerRecord record)
 {
     try
     {
         var handlerDoc = CommandHandlerRecord.ToBson(record);
         var query = Query.EQ("_id", record.CommandId);
         var update = Update.Push("Handlers", handlerDoc);
         Write.Logs.Update(query, update);
     }
     catch (Exception)
     {
         // Catch all errors because logging should not throw errors if unsuccessful
     }
 }
Ejemplo n.º 4
0
 public void LogCommandHandler(CommandHandlerRecord record)
 {
     try
     {
         var handlerDoc = CommandHandlerRecord.ToBson(record);
         var query      = Query.EQ("_id", record.CommandId);
         var update     = Update.Push("Handlers", handlerDoc);
         Write.Logs.Update(query, update);
     }
     catch (Exception)
     {
         // Catch all errors because logging should not throw errors if unsuccessful
     }
 }
        public static CommandHandlerRecord FromBson(BsonDocument doc)
        {
            var handler = new CommandHandlerRecord()
            {
                HandlerId = doc.GetString("HandlerId"),
                CommandId = doc.GetString("CommandId"),
                StartedDate = doc.GetDateTime("StartedDate"),
                EndedDate = doc.GetDateTime("EndedDate"),
                ErrorMessage = doc.GetString("ErrorMessage"),
                ErrorStackTrace = doc.GetString("ErrorStackTrace"),
                TypeName = doc.GetString("TypeName"),
            };

            return handler;
        }
        public static CommandHandlerRecord FromBson(BsonDocument doc)
        {
            var handler = new CommandHandlerRecord()
            {
                HandlerId       = doc.GetString("HandlerId"),
                CommandId       = doc.GetString("CommandId"),
                StartedDate     = doc.GetDateTime("StartedDate"),
                EndedDate       = doc.GetDateTime("EndedDate"),
                ErrorMessage    = doc.GetString("ErrorMessage"),
                ErrorStackTrace = doc.GetString("ErrorStackTrace"),
                TypeName        = doc.GetString("TypeName"),
            };

            return(handler);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// From Bson
        /// </summary>
        public static CommandHandlerRecordCollection FromBson(BsonValue doc)
        {
            var list = new List <CommandHandlerRecord>();

            if (!doc.IsBsonArray)
            {
                return(new CommandHandlerRecordCollection(list));
            }

            var evnts = doc.AsBsonArray;

            foreach (var evnt in evnts)
            {
                list.Add(CommandHandlerRecord.FromBson(evnt.AsBsonDocument));
            }

            return(new CommandHandlerRecordCollection(list));
        }