먼저 EF6과 코드를 사용하여 간단한 테이블을 만들고 있습니다. CreateDate
열을 제외한 모든 필드가 생성 됩니다. 왜 그런 겁니까?
public class InspectionPoint
{
public DateTime CreateDate { get; }
public string Detail { get; set; }
public int Id { get; set; }
public bool IsActive { get; set; }
public string Name { get; set; }
public string Question { get; set; }
public DateTime UpdateDate { get; set; }
}
UpdateDate
예상 아니라 같은 필드가 생성되고있다 CreateDate
. 왜 그런 겁니까?
나는 추측 해당 필드는 읽기 전용이기 때문에 단지 게터가 있기 때문에 그것이이다 :
public class InspectionPoint
{
// only has "get"ter - therefore it's readonly
public DateTime CreateDate { get; }
// Every other field has both "get" and "set" and can be set to new values
public string Detail { get; set; }
public int Id { get; set; }
public bool IsActive { get; set; }
public string Name { get; set; }
public string Question { get; set; }
public DateTime UpdateDate { get; set; }
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다