简体   繁体   English

ASPNET核心-DI dbcontext到jsonconverter

[英]aspnet core - DI dbcontext to jsonconverter

Is it possible? 可能吗? I saw two threads but all of them only have workaround solutions. 我看到了两个线程,但是它们都只有解决方法。 I tried the static but the dbcontext got dirty after first post and gave out exception something like change tracker already track the entity. 我尝试了静态方法,但是dbcontext在第一次发布后变得肮脏,并且发出了类似更改跟踪器已跟踪实体的异常。 The 2nd thread, I failed to make it work. 第二个线程,我无法使其正常工作。

  1. access dbcontext in custom Newtonsoft JsonConverter class 在自定义Newtonsoft JsonConverter类中访问dbcontext
  2. Custom Json Converter with dependecy 具有Dependecy的定制Json Converter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM