Beispiel #1
0
        internal static Activity CreateResetActivity()
        {
            MemoryPropertyBag memoryPropertyBag = new MemoryPropertyBag();

            memoryPropertyBag.SetProperty(ActivitySchema.ActivityId, ActivityId.Min);
            memoryPropertyBag.SetProperty(ActivitySchema.ClientId, ClientId.Exchange.ToInt());
            memoryPropertyBag.SetProperty(ActivitySchema.SessionId, AppendOnlyActivityLog.ResetActivityClientSessionId);
            memoryPropertyBag.SetProperty(ActivitySchema.TimeStamp, ExDateTime.UtcNow);
            return(new Activity(memoryPropertyBag));
        }
        private static Activity DeserializeActivity(BinaryReader reader, List <ActivityLogSerializer.SerializedPropertyInfo> propertyInfos)
        {
            MemoryPropertyBag memoryPropertyBag = new MemoryPropertyBag();

            foreach (ActivityLogSerializer.SerializedPropertyInfo serializedPropertyInfo in propertyInfos)
            {
                bool flag = reader.ReadBoolean();
                if (flag)
                {
                    object value = serializedPropertyInfo.PropertyDeserializer(reader);
                    if (serializedPropertyInfo.PropertyDefinition != null)
                    {
                        value = ActivityLogSerializer.ConvertPropertyValue(serializedPropertyInfo.PropertyDefinition, value);
                        memoryPropertyBag.SetProperty(serializedPropertyInfo.PropertyDefinition, value);
                    }
                }
            }
            return(new Activity(memoryPropertyBag));
        }