I'm a Java guy and I'm working on learning the .Net realm. One of the things I'm learning is EF4, and I noticed this interesting thing. When you declare an entity with a 1:n relationship to another entity, you have to do something like this:
public int CategoryId { get; set; }
public virtual Category Category { get; set; }
My question is:
Is there a good reason that the framework requires both declarations?
In the Java world, the framework is smart enough to figure out what the primary key is and adds that record to the DB without having to have a separate field on the entity class. Why didn't .Net follow suit on this minor, but annoying, issue?