I'm learning EF code first and my experience with c# is limited.
I created an entity but I didn't put { get; set; }
. EF failed to detect the key. After adding { get; set; }
, it detected.
I wonder what's the difference having / not having { get; set; }
?
public class Category
{
public int CategoryId { get; set; }
public string CategoryName { get; set; } = "";
}
and
public class Category
{
public int CategoryId
public string CategoryName
}
Thanks.