Nucs / JsonSettings

This library simplifies creating configuration for your C# app/service by utilizing the serialization capabilities of Json.NET to serialize nested (custom) objects, dictionaries and lists as simply as by creating a POCO and inheriting JsonSettings class.
MIT License
76 stars 18 forks source link

Exception error for virtual proeprty in AutoSave #27

Closed ghost1372 closed 3 years ago

ghost1372 commented 3 years ago

I always use the auto save module and I sometimes forget to define the properties virtual for AutoSave, I get into trouble when working with the program and look for the cause of the problem for a while Until I realize that the property is not defined virtual It would be nice to have an exception error in this case That we can understand that the property is not virtual

Nucs commented 3 years ago

Today I discovered that if a property is not virtual then the proxy not only ignores it's value but will have a completely independent property from the wrapped object. Therefore there is logic to enforcing all properties to be virtual even if IgnoreJsonAttribute or IgnoreAutosaveAttribute is specified in order to properly auto-save and make sure the object behaves as expected and not swallow any changes to non-virtual properties as they are not linked to the wrapped object.

Nucs commented 3 years ago

This is now enforced as of release alpha4.