LINQ To SQL query going in infinite loop.

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Posts: 1
Joined: Wed 08 Feb 2012 17:26
Location: India

LINQ To SQL query going in infinite loop.

Post by siddheshsawant1983 » 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.


Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 09 Feb 2012 17:27

Could you please specify the following:
- whether you are working with a LinqConnect or LINQ to SQL model;
- the version of LinqConnect (or Entity Developer) you are using;
- the exact way you are serializing entity objects.
If possible, please send us a small sample with which the problem can be reproduced.

For example, Entity Developer should not set a DataMember attribute on the Order.Customer navigation property by default, thus there should be no loops in the serialized Customer objects.

Post Reply