Smily
Smily

Reputation: 2674

A circular reference was detected while serializing an object of type in asp.net and sql

I am trying to fill gridpanel to get data from database through LINQ in .net framework 3.5 MVC and in Extjs MVC.

I am able to archive to get all data sucessfully from following code

public Object Get()
{
     var employeeList = _db.Employees;
     var result = new
     {
         data = employeeList
     };
     return this.Json(result, JsonRequestBehavior.AllowGet);
}

but when i am passing data to extjs model it will give following Error enter image description here

I am able to get my all data from database but Don't know where I am wrong?

Upvotes: 1

Views: 12714

Answers (1)

Ofer Zelig
Ofer Zelig

Reputation: 17470

The circular reference is caused by the Json serialization.

See my post here: Preventing StackOverflowException while serializing EF object graph into Json

This post might also help you: EntityFramework to Json workaround?

Upvotes: 4

Related Questions