title: Data model for User Notifications of many Types
body: <p>I am trying to figure out how to model notifications. This is what I tried.</p>
  
  <pre><code>public class NotificationType
  {
      public int NotificationTypeID { get; set; }
      public string Type { get; set; }
      public string Action { get; set; }
  }
  
  public class Notification
  {
      public int NotificationID { get; set; }
      public bool ReadStatus { get; set; }
      public DateTime DateCreated { get; set; }
      [ForeignKey("User")]
      public int UserID { get; set; }
      [ForeignKey("NotificationType")]
      public int NotificationTypeID { get; set; }
  
      public int CommentID { get; set; }
      public int ProjectID { get; set; }
  
      public Comment Comment { get; set; }
      public Project Project { get; set; }
      public NotificationType NotificationType { get; set; }
      public User User { get; set; }
  }
  </code></pre>
  
  <p>Frankly, I feel like I have no idea what I am doing still, but let me tell you what I was trying to do, if it's a bad idea, tell me, if not please tell me how I do it.</p>
  
  <p>I have <code>Notifications</code> that are for actions that occur related to a <code>Comment</code>, <code>Reply</code> and <code>Project</code> - That's why I have all those navigation properties and fields. I want to basically use the <code>NotificationType</code> to determine what it is and then use the appropriate ID field to get the information to display the notification to a user.</p>
  
  <p>First problem, I can't seem to make those ID (<code>CommentID</code> <code>ProjectID</code> ) fields Nullable so I don't always have to have them.</p>
  
  <p>How to I make them nullable using data annotations and or the fluent api OR design my model better?</p>