LINQ To SQL query going in infinite loop.
Posted: Wed 08 Feb 2012 17:38
Hi all ,
I have created a simple WCF service which uses dbml file. In db I have a Customer table with following columns
1) Customer id - PK
2) First Name
3) Last Name
And I have orders table as
1) Order Id - PK
2) Customer Id - FK
3) Comments
4) Quantity
there is one to many relationship. When there is no data in orders table following WCF operation works fine which gets customer list.
DbContext db = new DbContext()
Var custList = from c in db.Customers
select c
But when I insert some data in orders table for a particular customer , this operation never completes and goes in infinite loop. Order entity is exposed as a propert in customer entity in dbml class files.
Has anyone faced such issue before. Any help will be really appreciated.
Thanks
Siddhesh
I have created a simple WCF service which uses dbml file. In db I have a Customer table with following columns
1) Customer id - PK
2) First Name
3) Last Name
And I have orders table as
1) Order Id - PK
2) Customer Id - FK
3) Comments
4) Quantity
there is one to many relationship. When there is no data in orders table following WCF operation works fine which gets customer list.
DbContext db = new DbContext()
Var custList = from c in db.Customers
select c
But when I insert some data in orders table for a particular customer , this operation never completes and goes in infinite loop. Order entity is exposed as a propert in customer entity in dbml class files.
Has anyone faced such issue before. Any help will be really appreciated.
Thanks
Siddhesh