How do I make JSON.NET ignore object relationships?

前端 未结 3 1515
被撕碎了的回忆
被撕碎了的回忆 2020-12-15 04:12

I\'m working on an Entity Framework project. I want to serialize a bunch of entity class instances. I\'ve bound these together into a container class:

public         


        
3条回答
  •  甜味超标
    2020-12-15 05:00

    An easier method is to modify your model T4 template (.tt) to append [JsonIgnore] attributes to your navigation properties, which will just leave the primitive types as serializable.

提交回复
热议问题