Two things, I am new to MVC and need to confirm if this looks right. Also I am told by the IDE that a public string is not nullable. The database would have a nullable varchar type.
vb Code:
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.ComponentModel.DataAnnotations.Schema;
  5. using System.Linq;
  6. using System.Web;
  7.  
  8. namespace NotaryNet.Models
  9. {
  10.     /// <summary>
  11.     /// Registration Database Structure.
  12.     /// </summary>
  13.     /// <remarks>
  14.     /// 1. Company name during registration must be unique. Not allow same company name to be registered.
  15.     /// 2. Initial registered user is automatically assigned to the Admin Role and they can register/create additional users as needed.
  16.     ///     A. If any additional user accounts are created by the Admin, they will be added to the Users role.
  17.     /// 3. Each SystemUser has their own respective information about them in the SystemUsersInfo table.
  18.     ///
  19.     /// 1. Company and SystemUsers share a PK (CompanyID) and FK (CompanyID) relationship.
  20.     /// 2. SystemUsers and SystemUsersInfo share a PK (UserID) and FK (UserID) relationship.
  21.     /// </remarks>
  22.  
  23.     [Table("Companies")]
  24.     public class Register
  25.     {
  26.         [Key]
  27.         public int CompanyID { get; set; }
  28.         public string CompanyName { get; set; }
  29.         public bool IsActive { get; set; }
  30.         public virtual ICollection<SystemUsers> SystemUsers { get; set; }
  31.     }
  32.  
  33.     [Table("SystemUsers")]
  34.     public class SystemUsers
  35.     {
  36.         [Key]
  37.         public int UserID { get; set; }
  38.         public string Username { get; set; }
  39.         public string Password { get; set; }
  40.         public bool IsActive { get; set; }
  41.         [ForeignKey("CompanyID")]
  42.         public virtual ICollection<SystemUserInfo> SystemUserInfo { get; set; }        
  43.     }
  44.  
  45.     [Table("SystemUserInfo")]
  46.     public class SystemUserInfo
  47.     {
  48.         [Key]
  49.         public int SystemUserInfoID { get; set; }
  50.         public string NamePrefix { get; set; }
  51.         public string FirstName { get; set; }
  52.         public string? MiddleInitial { get; set; }
  53.         public string LastName { get; set; }
  54.         public string? NameSuffix { get; set; }
  55.         [ForeignKey("UseID")]
  56.     }
  57. }