I have a ChatSequence entity with a DateTimeCreated property that's a DateTime. But when I try and set it, I get an exception that's saying nullreferenceexception
I'm setting it like this
ChatSequence newSequence = new ChatSequence();
sequence.DateTimeCreated = DateTime.UtcNow;
and here is the object
public class ChatSequence
{
[Key]
public int ChatSequenceId { get; set; }
public int TotalMessages { get; set; }
[Index]
public int ToYogaProfileRefId { get; set; }
[ForeignKey("ToYogaProfileRefId")]
public virtual YogaProfile ToProfile { get; set; }
//[Index]
//public int FromId { get; set; }
[Index]
public int FromYogaProfileRefId { get; set; }
[ForeignKey("FromYogaProfileRefId")]
public virtual YogaProfile FromProfile { get; set; }
[Index]
public DateTime LastMessageSent { get; set; }
[Index]
public int PartitionId { get; set; }
public DateTime DateTimeCreated { get; set; }
}