I have a Product table with fields like:
public class Product {
public int ID {get;set;}
...
}
and a table that joins Products to other "cross sell" products (like items):
public class CrossSell {
public int ProductID {get;set;}
public int CrossSellID {get;set;}
}
My intent is, given any product, get a list of cross sell products.
Entity Framework 4 (EF second edition) takes these tables and creates a Product and Product1 relation, where the line that joins the table is called a CrossSell.
What I want to have is:
public class Product {
public int ID {get;set;}
...
public IList<Product> CrossSells {get;set;}
}
EF created this:
public class Product {
public int ID {get;set;}
...
public IList<Product> Products {get;set;}
public IList<Product> Products1 {get;set;}
}
Could I simply delete the the second List called Products1, rename the first to "CrossSells" and have all this just magically work? Should I remake the SQL tables differently so EF better understands my intent? What would these SQL tables look like if a single product can have multiple cross sell items?
EDIT:
What I am really looking for is a way to represent CrossSell items in EF without a circular reference. Right now, Product refers to other products which in turn refer to other products which in turn ...