What Is The Proper Way To Create A Recursive Entity In The Entity Framework?
I'm currently using VS 2010 RC, and I'm trying to create a model that contains a recursive self-referencing entity. Currently when I import the entity from the model I get an error
Solution 1:
EF can support recursive objects. You just have to import the model and EF will pick up the relationship and will allow you to do recursion.
See MSDN.
About your FK, I don't understand why you have a CHECK CONSTRAINT. Adding a FK should be like this :
ALTERTABLE Appointments
ADDFOREIGN KEY (RecurrenceParentId) REFERENCES Appointments(AppointmentId);
Maybe something went wrong with your FK creation and EF cannot handle it ?
Hope this helps !
Edit: haha, just saw it was asked 9 months ago ... Well, never mind :)
Post a Comment for "What Is The Proper Way To Create A Recursive Entity In The Entity Framework?"