示例#1
0
        /// <summary>
        /// Serializes the object to JSON.
        /// </summary>
        /// <param name="writer">The <see cref="T: Newtonsoft.Json.JsonWriter" /> to write to.</param>
        /// <param name="obj">The object to serialize to JSON.</param>
        internal static void Serialize(JsonWriter writer, AnalysisEventMetadata obj)
        {
            // Required properties are always serialized, optional properties are serialized when not null.
            writer.WriteStartObject();
            if (obj.Delay != null)
            {
                writer.WriteProperty(obj.Delay, "Delay", JsonWriterExtensions.WriteTimeSpanValue);
            }

            if (obj.Duration != null)
            {
                writer.WriteProperty(obj.Duration, "Duration", JsonWriterExtensions.WriteTimeSpanValue);
            }

            writer.WriteEndObject();
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the PartitionAnalysisEvent class.
 /// </summary>
 /// <param name="eventInstanceId">The identifier for the FabricEvent
 /// instance.</param>
 /// <param name="timeStamp">The time event was logged.</param>
 /// <param name="category">The Category of the Event.</param>
 /// <param name="partitionId">An internal ID used by Service Fabric to
 /// uniquely identify a partition. This is a randomly generated GUID
 /// when the service was created. The partition ID is unique and does
 /// not change for the lifetime of the service. If the same service was
 /// deleted and recreated the IDs of its partitions would be
 /// different.</param>
 /// <param name="metadata">Metadata about an Analysis Event.</param>
 /// <param name="hasCorrelatedEvents">Shows that there is existing
 /// related events available.</param>
 public PartitionAnalysisEvent(Guid eventInstanceId, DateTime timeStamp, string category, Guid partitionId, AnalysisEventMetadata metadata, bool?hasCorrelatedEvents = false)
     : base(eventInstanceId, timeStamp, category, partitionId, hasCorrelatedEvents)
 {
     Metadata = metadata;
 }