EF Core, INotifyPropertyChanged

c# ef-core-2.0 entity-framework-core

Question

I am implementing the INotifyPropertyChanged Interface on my EF POCOs. I am using newtonsoft to serialize my models to JSON. Currently my object is using [JsonProperty] attributes to tell newtonsoft what to serialize. When I implement this interface I will have properties with private backing fields. Do I place the [JsonProperty] attribute on the properties or on the backing fields?

1
0
12/7/2017 10:35:44 PM

Popular Answer

I would put it on the property personally. In my example i have an Order POCO with a list LineItems that hangs off of it.

[DataMember]
[JsonProperty(TypeNameHandling = TypeNameHandling.Objects)]
public List<LineItem> LineItems { get; set; }
0
4/27/2018 6:30:30 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow