none
Entity Framework Circular Reference Error in One-to-One Relationship RRS feed

  • Question

  • I am using entity framework that came with .net 3.5 sp1.I am encountering circular reference error when I create a one to one relationship between two entities.

    Let say there is entity A and entity B and they are linked together by pk-fk relationship.It is as simple as that but I am getting circular reference error.

    Moreover, is there a way to predict in the application where exactly it would have been happening ?

    Thanks,

    BR,

    JollyWagoner

    • Moved by CoolDadTx Tuesday, October 1, 2013 9:21 PM EF related
    Tuesday, October 1, 2013 2:56 PM

All replies

  • >I am using entity framework that came with .net 3.5 sp1

    I would try hard not to do that.  Entity Framework is barely usable in .NET 3.5.  If you must stay on .NET 3.5 then LINQ 2 SQL is a much nicer experience.  On .NET 4, Entity Framework 5 and 6 are much, much nicer to work with.

    David


    David http://blogs.msdn.com/b/dbrowne/

    Tuesday, October 1, 2013 2:58 PM
  • Sounds like you are trying to do a join... anyway upgrade to .Net4/C#4 or .Net4.5/C#5 and upgrade your entitity framework to the latest which is 6 at this time I believe.
    Tuesday, October 1, 2013 3:09 PM
  • Unfortunately , upgrading is not an option for me.Kindly suggest a work around or is this a known issue with EF 3.5  ? Can't we simply create 1-1 relationship just because it creates circular reference ?
    Tuesday, October 1, 2013 3:19 PM
  • I am not doing any join in linq query .Its just that I dragged two tables on entity framework table designer surface and created an association and when used in code , it throws circular reference exist error.
    Tuesday, October 1, 2013 3:32 PM
  • Hello,

    It seems that you have used the DataBase First.

    So could you please share your table structures so that we can do a test with it?

    Regards.

    Wednesday, October 2, 2013 3:40 AM