Acropolis.Foundation.EventSourcing.Logging.EventHandlerRecord.FromBson C# (CSharp) Method

FromBson() public static method

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

            return handler;
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// From Bson
        /// </summary>
        public static EventHandlerRecordCollection FromBson(BsonValue doc)
        {
            var list = new List <EventHandlerRecord>();

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

            var evnts = doc.AsBsonArray;

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

            return(new EventHandlerRecordCollection(list));
        }
EventHandlerRecord