using System;

namespace JustSaying.Models
{
    public abstract class Message
    {
        protected Message()
        {
            TimeStamp = DateTime.UtcNow;
            Id = Guid.NewGuid();
        }

        public Guid Id { get; set; }
        public DateTime TimeStamp { get; private set; }
        public string RaisingComponent { get; set; }
        public string Version{ get; private set; }
        public string SourceIp { get; private set; }
        public string Tenant { get; set; }
        public string Conversation { get; set; }
        
        //footprint in order to avoid the same message being processed multiple times.
        public virtual string UniqueKey()
        {
            return Id.ToString();
        }
    }
}
using System;

namespace JustSaying.Models
{
    public abstract class Message
    {
        protected Message()
        {
            TimeStamp = DateTime.UtcNow;
            Id = Guid.NewGuid();
        }

        public Guid Id { get; set; }
        public DateTime TimeStamp { get; set; }
        public string RaisingComponent { get; set; }
        public string Version{ get; private set; }
        public string SourceIp { get; private set; }
        public string Tenant { get; set; }
        public string Conversation { get; set; }
        
        //footprint in order to avoid the same message being processed multiple times.
        public virtual string UniqueKey()
        {
            return Id.ToString();
        }
    }
}

Allow message TimeStamp to be set when deserializing
Allow message TimeStamp to be set when deserializing

Made TimeStamp property setter public so that Json.NET can restore it's state to whatever is in the json, rather than leaving it to the time of when it was deserialized.