EFDB 基本规范&知识

  

  public abstract class AccountRole //这是继承类型
    {
        [Key]
        public int ID { get; set; }
        public bool isDisabled { get; set; }
        public string email { get; set; }
        public string remark { get; set; }
        public string firstName { get; set; }
        public string lastName { get; set; }
        public string taskss { get; set; }

        [ForeignKey("account")]
        public int Accounts_id { get; set; }
        public virtual Account account { get; set; }

        [DatabaseGenerated(DatabaseGeneratedOption.Computed)]
        public DateTimeOffset rowCreatedDT { get; set; }
        [DatabaseGenerated(DatabaseGeneratedOption.Computed)]
        [ConcurrencyCheck]
        public byte[] rowVersion { get; set; }
        [ForeignKey("rowCreator")]
        public int? rowCreatorLoginAccounts_ID { get; set; }
        [ForeignKey("rowLastModifiedBy")]
        public int? rowLastModifiedByLoginAccounts_ID { get; set; }

        public virtual LoginAccount rowCreator { get; set; }
        public virtual LoginAccount rowLastModifiedBy { get; set; }
    }public class MemberRole : AccountRole //memberROle 继承 accountROle
    {
        public MemberRole()
        {
            businessResultComplex = new BusinessResultComplex { };
            monthlyTaskComplex = new MonthlyTaskComplex { };
        }
        public string investorOrIB { get; set; }
        public string MT4ID { get; set; }
        public string fullName { get; set; }
        public DateTime dateOfBirth { get; set; }
        public string alternativeEmail { get; set; }
        public string contactNumber { get; set; }
        public string gender { get; set; } 
        public BeneficiaryComplex beneficiaryComplex { get; set; } //complex 类型
        public AddressComplex addressComplex { get; set; }
        public BankComplex bankComplex { get; set; }
        public BusinessResultComplex businessResultComplex { get; set; }
        public MonthlyTaskComplex monthlyTaskComplex { get; set; }
        public DateTimeOffset lastLoginDT { get; set; }  //dateTime原始类型
        public DateTime TTDate { get; set; } //date原始类型
                
        [ForeignKey("currentLevel")]
        public int Levels_ID { get; set; }
           
        public MemberMLMRelationTree MLMRelationTree { get; set; } 
        public BankBalance bankBalance { get; set; }
        public Level currentLevel { get; set; }

        public List<HistoryLogin> historyLogins { get; set; }
        public List<HistoryBankTransaction> historyBankTransactions { get; set; }         
        public List<HistoryLevel> historyLevels { get; set; }
        public List<Withdrawal> withdrawals { get; set; } 
        public List<MemberContract> contracts { get; set; }
    }
  public class HistoryLogin : RowInfo
    {
        [Key]
        public int ID { get; set; }

        [ForeignKey("member")]
        public int Members_ID { get; set; }

        public MemberRole member { get; set; }
    }

EFDB是sql的结构, 大家都是类型(class), 但是有些时候会有大量重复, 所以会有继承(abstract)

原始类型有 string, int, datetime, date

在类型里可以有其他类型, 如果类型是complex就是一种集合(规范) , list(这是多对多或一对多的关系) , enum

原文地址:https://www.cnblogs.com/stooges/p/5023756.html