【问题标题】:Dropdown List in Razor pages with entity framework code first ApproachRazor 页面中的下拉列表,首先使用实体​​框架代码方法
【发布时间】:2022-06-15 21:11:29
【问题描述】:

我是 EF 核心和 Razor 页面项目的新手。也使用 Ms Identity。我正在制作一个网站,我需要使用 CODE FIRST 方法制作国家和部门下拉列表。那么我是否必须为每个属性创建不同的模型类并迁移并制作一个列表?或者还有其他方法吗? Razor Pages 是非常新的,所以我没能找到任何正确的代码优先方式。你们能帮忙吗? 我的 ApplicationUser.cs 类

 public class ApplicationUser : IdentityUser
{
   
     public string FirstName { get; set; }
    
     public string LastName { get; set; }

     public string EmployeCode { get; set; }

     public string Designation { get; set; }

     public DateTime DateOfBirth { get; set; }

     public DateTime  DateOfJoining { get; set; }

     public string EmergencyNo { get; set; }

     public string AdharNo { get; set; }

    /*
   //Department dropdown and city and country thing
   //public string Gender { get; set; }
   //public string[] Genders = new[] { "Male", "Female", "Unspecified" };
    */  //public string FullName { get; set; }
    public string Address { get; set; }
    public string City { get; set; }
    public string PostalCode { get; set; }

  

}

【问题讨论】:

  • 离题了,但是你能不能不要把你写的每一个单词都大写?这在英语中并不常见,也不需要,而且 - 至少对我来说 - 非常分散注意力。 “Razor Pages”很好,因为这是一个产品名称,但不是其他词。
  • 先生,恕我直言,我试图让我的问题尽可能清楚。以前我添加了一个问题并获得了反对票..当我问原因时,得到的答案就像“你必须非常清楚和具体地说明你的问题的每一部分,我们自己不在这里理解”。那太粗鲁了……现在告诉我该怎么办?

标签: entity-framework asp.net-identity asp.net-core-razor-pages


猜你喜欢
  • 1970-01-01
  • 2011-08-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-05-03
  • 1970-01-01
相关资源
最近更新 更多