EF4 CTP5 - Map foreign key without object references?

Posted by anon on Stack Overflow See other posts from Stack Overflow or by anon
Published on 2011-03-05T22:42:35Z Indexed on 2011/03/05 23:25 UTC
Read the original article Hit count: 405

I feel like this should have a simple answer, but I can't find it.

I have 2 POCOs:

public class Category
{
    public int Id { get; set; }
    public string Name { get; set; }
}

public class Product
{
    public int Id { get; set; }
    public int CategoryId { get; set; }
}

Notice that there are no object references on either POCO. With Code-First, how do I make EF4 CTP5 define a relationship between the two database tables?

(I know this is an unusual scenario, but I am exploring what's possible and what's not with Code-First)

© Stack Overflow or respective owner

Related posts about entity-framework-4

Related posts about mapping