Exemple #1
0
        /// <summary>
        /// Gets the dictionary that represents a flatten version of the current record.
        /// <para>
        /// It can be used to flat the conversation record and to create dynamic object from it.
        /// </para>
        /// </summary>
        /// <returns>A dictionary of fields and values for the passed conversation record.</returns>
        public static Dictionary <string, object> AsDictionary <T>(this ConversationRecord <T> self)
        {
            var dictionary = RecordTypeRegister.GetRecordInfo(self.GetType()).ToDictionary(x => x.Name, y => y.ValueGetter.Invoke(self));

            return(dictionary);
        }
 public static ConversationRecord <TData> Combine(Func <TData, TData, TData> combineData, ConversationRecord <TData> left, ConversationRecord <TData> right)
 {
     return(new ConversationRecord <TData>
     {
         Key = left.Key,
         OriginalFlowsPresent = left.OriginalFlowsPresent + right.OriginalFlowsPresent,
         ForwardMetrics = FlowMetrics.Aggregate(ref left.ForwardMetrics, ref right.ForwardMetrics),
         ReverseMetrics = FlowMetrics.Aggregate(ref left.ReverseMetrics, ref right.ReverseMetrics),
         Data = combineData(left.Data, right.Data)
     });
 }