WeavyContractResolver Class

Namespace:
Weavy.Core.Json
Assembly:
Weavy.Core.dll

Custom contract resolver that removes empty collections, injects additional properties and uses snake_casing for the property names.

public class WeavyContractResolver : DefaultContractResolver
Inheritance:
System.Object → WeavyContractResolver

Constructors

WeavyContractResolver() Initializes a new instance of the WeavyContractResolver class.

Methods

CreateProperties(Type, MemberSerialization) Adds some json properties when serializing entities.
CreateProperty(MemberInfo, MemberSerialization) Makes sure empty collections are not serialized.
ResolvePropertyName(string) Returns the snake_cased name of the property.

Extension Methods

IsNullOrDefault(T) Gets a value indicating if the specified value has the default value of the generic type.
Serialize(object) Serializes an object, or graph of connected objects, to a byte array.
SerializeToJson(object, Formatting?, JsonSerializerSettings) Serializes an object, or graph of connected objects, to a json string.
IsValid(object) Determines whether the specified object is valid by evaluating each ValidationAttribute instance that is attached to the object type.