Avoid using the JsonIgnore attribute in a domain model

后端 未结 3 1788
醉梦人生
醉梦人生 2020-12-17 18:35

I have a domain model component with several entity classes. In another component i have entity repositories implemented using Json.NET serialization. I want to ignore some

3条回答
  •  天涯浪人
    2020-12-17 19:25

    You might consider using something like a View Model to control which properties of your entity model are serialized. I haven't used it myself, but looked into using it for a project of mine, but AutoMapper might be something to look into to decouple the entity model from your serialized model.

提交回复
热议问题