linq to sql webservice 出现循环引用的问题 RRS feed

  • 问题

  • 我的环境是 vs2010 beta1,linq to sql 错误提示如下,请问如何解决啊 System.Web.Services.Protocols.SoapException was unhandled by user code Message=System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: A circular reference was detected while serializing an object of type Ef.pxb_jg. at System.Xml.Serialization.XmlSerializationWriter.WriteStartElement(String name, String ns, Object o, Boolean writePrefixed, XmlSerializerNamespaces xmlns) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write11_pxb_jg(String n, String ns, pxb_jg o, Boolean isNullable, Boolean needType)
    2009年9月8日 13:12


  • pxb_jg类的成员里面有pxb_jg类型的?

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
    2009年9月8日 18:17
  • /*机构*/
    if EXISTS (SELECT * FROM dbo.sysobjects WHERE name='pxb_jg')
    DROP TABLE pxb_jg
    CREATE TABLE  pxb_jg (
      id int identity not null,
      reg_id int not null,  /*注册人*/
      parent_id int,
      name varchar(100) not null,  /*名称*/ 
      simplename varchar(10) not null,  /*简称*/
      phone varchar(20),   /*联系电话*/
      address varchar(60),   /*地址*/
      jd varchar(22),   /*经度*/
      wd varchar(22),   /*纬度*/
      zcm char(6) ,  /*注册码*/
      position int not null default '99',
      updated_at datetime,
      created_at datetime,
      primary key(id)
    alter table pxb_jg add constraint fk_pxb_jg_reg foreign key(reg_id) references sys_user(id);
    --alter table pxb_jg add constraint fk_pxb_jg_parent foreign key(parent_id) references pxb_jg(id);
    if EXISTS (SELECT * FROM dbo.sysobjects WHERE name='pxb_privilege_jg')
    DROP TABLE pxb_privilege_jg
    CREATE TABLE  pxb_privilege_jg (
      id int identity not null,
      user_id int not null,
      privilege_id int not null,
      jg_id int not null, 
      updated_at datetime not null default getdate(),
      created_at datetime default getdate(),
      PRIMARY KEY (id)
    alter table pxb_privilege_jg add constraint fk_pxb_privilege_jg_user foreign key(user_id) references sys_user(id);
    alter table pxb_privilege_jg add constraint fk_pxb_privilege_jg_jg foreign key(jg_id) references pxb_jg(id);
    alter table pxb_privilege_jg add constraint fk_pxb_privilege_jg_privilege foreign key(privilege_id) references sys_privilege(id);

    2009年9月9日 1:35
  • 这里有对这个问题的说明

    但在vs2010里,parent property->access, 只有public, internal 没有Friend选项;这个问题如何解决啊,困扰很长时间了
    2009年9月9日 2:00