2
MVC 3을 사용하여 웹 응용 프로그램을 작성합니다. 다른 역할과 권한을 가진 사용자가 있습니다. 데이터베이스 생성을 위해 EF Code First 접근 방식을 사용하고 있습니다.EF 코드 우선 및 ASP.NET 멤버십 공급자
public class Users
{
public int UserID { get; set; }
public Name Name { get; set; }
public Address Address { get; set; }
public Contact Contact { get; set; }
}
public class Name
{
[Required, MaxLength(50), Display(Name = "First Name"), Column("FirstName")]
public string FirstName { get; set; }
[MaxLength(50), Display(Name = "Middle Name"), Column("MiddleName")]
public string MiddleName { get; set; }
[Required, MaxLength(50), Display(Name = "Last Name"), Column("LastName")]
public string LastName { get; set; }
}
public class Address
{
[Required, MaxLength(50), Display(Name = "Street"), Column("Street")]
public string Street { get; set; }
[Required, MaxLength(50), Display(Name = "City"), Column("City")]
public string City { get; set; }
[Required, MaxLength(50), Display(Name = "Country"), Column("Country")]
public string Country { get; set; }
[Required, MaxLength(5), Display(Name = "Postal Code"), Column("PostalCode")]
public string PostalCode { get; set; }
}
public class Contact
{
[Required, MaxLength(50), Display(Name = "Email"), Column("Email")]
public string Email { get; set; }
[Required, MaxLength(50), Display(Name = "Phone"), Column("Phone")]
public string Phone { get; set; }
[Required, MaxLength(50), Display(Name = "Fax"), Column("Fax")]
public string Fax { get; set; }
}
그러나 역할과 인증을 위해 나는 기본 App_Data
폴더의 aspnetdb.mdf
를 사용하려면 : 사용자에 대한 내 모델 클래스이다. Users
테이블을 Users
테이블 (예 : aspnetdb.mdf
)과 연결하려면 어떻게해야합니까?