0
Answer

Entity Framework (Self-Tracking Entities)

David Keylock

David Keylock

12y
1.2k
1

I have added a Self-Tracking Entity Generator to my existing Entity Framework setup.

Now when I retrieve a World record from the database, for example

public class World
{
    public Guid Id { get; set; }
    public string Name { get; set; }
    public string Universe { get; set; }
    public EntityCollection<Country> Countries { get; set; }
}

which has a 1 to Many relationship to the table Country, the collection Countries is 0 and I know that in the database the records in the Country table exist.

By adding the Self-Tracking Entity Generator I have somehow destroyed the databases relationships.

Does anyone know how I can use a Self-Tracking Entity Generator but preserve the relationships?

Many thanks