2

我正在使用 asp.net mvc 4 在我的控制器中使用以下代码获取 linq to sql 模型的列名:

var dataContext = new OrdersDataContext();
var columnNames = dataContext.Mapping.MappingSource
                    .GetModel(typeof(OrdersDataContext))
                    .GetMetaType(typeof(Order))
                    .DataMembers;

我收到以下错误:

A circular reference was detected while serializing an object of type
'System.Data.Linq.Mapping.AttributedRootType

这个错误可能来自哪里。

4

1 回答 1

0

Check your relationships between the tables in the DBML file. You probably have a cycle (circle) between them. Follow the lines.

于 2014-01-31T16:29:52.960 回答