-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
I need to deserialize a document into a domain type where the properties have only private setters and no constructor is available.
In your implementation you don't allow to override the DefaultContractResolver because you recreate it each time the db connection is used, so i'm not able to resolve this by my own without creating new models.
So would you please allow overriding the DefaultContractResolver or add the following workaround to the current implementation?
Pull request: #130
public class NonPublicPropertiesResolver : DefaultContractResolver
{
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
var prop = base.CreateProperty(member, memberSerialization);
if (!(member is PropertyInfo pi)) { return prop; }
prop.Readable = (pi.GetMethod != null);
prop.Writable = (pi.SetMethod != null);
return prop;
}
}
Metadata
Metadata
Assignees
Labels
No labels