使用代码首先approch映射现有数据库

时间:2017-02-13 04:10:16

标签: asp.net entity-framework

我已经实现了没有Code第一种方法的asp .net应用程序。现在我想先用现有的数据库和代码构建不同的系统。

 public class EmployeeEntity
    {
        public int Id { get; set; }

        public string ResourceCode { get; set; }

        public string FirstName { get; set; }

        public string LastName { get; set; }

        public DateTime DateOfBirth { get; set; }

        public int Gender { get; set; }

        public int Status { get; set; }

        public string NIC { get; set; }
}

现在我想添加代码第一个实体。

 [Table("ExternalApplicantEntity")]
    public class ExternalApplicantEntity
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int ApplicantID { get; set; }

        //[ForeignKey("EmployeeEntity")]
        //public int Created_By { get; set; }
        //public virtual EmployeeEntity EmployeeEntity { get; set; }

        public string NIC { get; set; }

        public string Mobile { get; set; }

        public string Institute { get; set; }

我如何组合这些代码?

0 个答案:

没有答案
相关问题