I am very new to the Entity Framework, having decided that once and for all I am going to do a project using it and get some practice. I have a question regarding POCO object relationships for CodeFirst development.
The examples I have seen would layout an object like this:
public class Fruit {
public int FruitId { get; set; }
public string FruitName { get; set; }
}
public class Basket {
public int BasketId { get; set; }
public int FruitId { get; set; }
public Fruit Contents { get; set; }
}
My question is, in the basket class, why define a FruitId and a Fruit Object? Wouldn't the existence of the Fruit Object imply the Id value?