EF 多对多循环引用序列化失败 解决办法
2024-10-11 23:57:12
错误:Self referencing loop detected with type 'System.Data.Entity.DynamicProxies.tbldph_901D48A194FB31357
添加[JsonIgnore] 可解决
[Table("tbldph")]
public partial class tbldph
{
public tbldph()
{
tbldphcaselinks = new HashSet<tbldphcaselink>();
tbldphnotices = new HashSet<tbldphnotice>();
tbldphparticipants = new HashSet<tbldphparticipant>();
tbldphpagelinks = new HashSet<tbldphpagelink>();
} [Key]
public int DphId { get; set; } public int? Series_DphSeriesId { get; set; } [ForeignKey("Series_DphSeriesId")]
public virtual tbldphseries Series { get; set; } public long? Mc_UserId { get; set; } [ForeignKey("Mc_UserId")]
public virtual tbluser Mc { get; set; } public long? Creator_UserId { get; set; } [ForeignKey("Creator_UserId")]
public virtual tbluser Creator { get; set; }
public DateTime? CreateTime { get; set; } public DateTime? LastModifyTime { get; set; } public virtual ICollection<tbldphcaselink> tbldphcaselinks { get; set; } public virtual ICollection<tbldphnotice> tbldphnotices { get; set; } public virtual ICollection<tbldphpagelink> tbldphpagelinks { get; set; } [InverseProperty("tbldph")]
public virtual ICollection<tbldphparticipant> tbldphparticipants { get; set; } [InverseProperty("tbldph")]
public virtual ICollection<tbldphattachment> tbldphattachments { get; set; }
public string test { get; set; }
public string Content { get; set; }
}
[Table("tbldphcaselink")]
public partial class tbldphcaselink
{
[Key]
public int DphCaseLinkId { get; set; } public int DphId { get; set; } public int CaseId { get; set; } public int? CheckID { get; set; } [JsonIgnore]
[ForeignKey("DphId")]
public virtual tbldph tbldph { get; set; }
}
解决办法:外键添加[JsonIgnore] 特性即可解决
最新文章
- 转:永久解决火狐浏览器出现的flash版本更新问题
- Linux下Nagios的安装与配置
- Mysql查询(笔记二)
- 由于本公司项目需要,现急需拥有微软MCSE证书的人才,一经录用,待遇从优!
- 函数还能这样玩儿~实现类似add(1)(2)(3)的函数
- c语言数组小练习
- asp.net访问网络路径方法(模拟用户登录)
- IOS 跳转到系统的url
- JVM类加载机制---类加载的过程
- Python爬虫基础之认识爬虫
- Oracle列转行函数LISTAGG()
- spring集成cxf实现webservice接口功能
- HTML meta头部小结
- JavaScript加强
- 5.mybatis实战教程(mybatis in action)之五:与spring3集成(附源码)
- systemctl自定义service
- 浅谈ASP.net中的DataSet对象
- jQuery实现布局高宽自适应
- PLSQL Developer V10 注册码
- POJ 2348 Euclid&#39;s Game(辗转相除博弈+自由度分析)
热门文章
- Raft 一致性算法论文译文
- 【深度好文】多线程之WaitHandle-->;派生-》Semaphore信号量构造
- 03 解析库之Beautifulsoup模块
- BZOJ3170: [Tjoi2013]松鼠聚会 - 暴力
- asp.net core 视图组件化
- 使用eclipse创建android项目的时候为什么会生成两个项目
- hdu-1069(dp)
- python 文件合并和编号
- SPSS-单因素方差分析(ANOVA) 案例解析
- 6.<;1>;四则运算的研究[栈]