Class MemberDefinition
- Namespace
- Alis.Core.Aspect.Data.Json
- Assembly
- Alis.dll
Defines a type's member.
public sealed class MemberDefinition
Inheritance
Inherited Members
Fields
_accessor
The accessor
private IMemberAccessor _accessor
Field Value
_escapedWireName
The escaped wire name
private string _escapedWireName
Field Value
_name
The name
private string _name
Field Value
_type
The type
private Type _type
Field Value
_wireName
The wire name
private string _wireName
Field Value
Properties
Accessor
Gets or sets the accessor.
public IMemberAccessor Accessor { get; set; }
Property Value
DefaultValue
Gets or sets the default value.
public object DefaultValue { get; set; }
Property Value
EscapedWireName
Gets or sets the escaped name used during serialization and des-serialization.
public string EscapedWireName { get; set; }
Property Value
HasDefaultValue
Gets or sets a value indicating whether this instance has default value.
public bool HasDefaultValue { get; set; }
Property Value
Name
Gets or sets the member name.
public string Name { get; set; }
Property Value
Type
Gets or sets the member type.
public Type Type { get; set; }
Property Value
WireName
Gets or sets the name used for serialization and des-serialization.
public string WireName { get; set; }
Property Value
Methods
AddDeserializationMember(Type, JsonOptions, MemberDefinition)
Adds a deserialization member.
public static void AddDeserializationMember(Type type, JsonOptions options, MemberDefinition member)
Parameters
type
Type-
The type. May not be null.
options
JsonOptions-
The options. May be null.
member
MemberDefinition-
The member. May not be null.
AddSerializationMember(Type, JsonOptions, MemberDefinition)
Adds a serialization member.
public static void AddSerializationMember(Type type, JsonOptions options, MemberDefinition member)
Parameters
type
Type-
The type. May not be null.
options
JsonOptions-
The options. May be null.
member
MemberDefinition-
The member. May not be null.
ApplyEntry(IDictionary, object, string, object, JsonOptions)
Applies the dictionary entry to this member.
public void ApplyEntry(IDictionary dictionary, object target, string key, object value, JsonOptions options = null)
Parameters
dictionary
IDictionary-
The input dictionary.
target
object-
The target object.
key
string-
The entry key.
value
object-
The entry value.
options
JsonOptions-
The options.
EqualsDefaultValue(object)
Determines if a value equals the default value.
public bool EqualsDefaultValue(object value)
Parameters
value
object-
The value to compare.
Returns
- bool
-
true if both values are equal; false otherwise.
GetDeserializationMembers(Type, JsonOptions)
Gets the deserialization members for a given type.
public static MemberDefinition[] GetDeserializationMembers(Type type, JsonOptions options = null)
Parameters
type
Type-
The type. May not be null.
options
JsonOptions-
The options. May be null.
Returns
- MemberDefinition[]
-
A list of deserialization members.
GetOrCreateInstance(object, int, JsonOptions)
Gets or creates a member instance.
private object GetOrCreateInstance(object target, int elementsCount, JsonOptions options = null)
Parameters
target
object-
The target.
elementsCount
int-
The elements count.
options
JsonOptions-
The options.
Returns
- object
-
A new or existing instance.
GetSerializationMembers(Type, JsonOptions)
Gets the serialization members for a given type.
public static MemberDefinition[] GetSerializationMembers(Type type, JsonOptions options = null)
Parameters
type
Type-
The type. May not be null.
options
JsonOptions-
The options. May be null.
Returns
- MemberDefinition[]
-
A list of serialization members.
IsNullDateTimeValue(object)
Determines whether the specified value is equal to the zero value for its type.
public bool IsNullDateTimeValue(object value)
Parameters
value
object-
The value.
Returns
- bool
-
true if the specified value is equal to the zero value.
IsZeroValue(object)
Determines whether the specified value is equal to the zero value for its type.
public bool IsZeroValue(object value)
Parameters
value
object-
The value.
Returns
- bool
-
true if the specified value is equal to the zero value.
RemoveDeserializationMember(Type, JsonOptions, MemberDefinition)
Removes a deserialization member.
public static bool RemoveDeserializationMember(Type type, JsonOptions options, MemberDefinition member)
Parameters
type
Type-
The type. May not be null.
options
JsonOptions-
The options. May be null.
member
MemberDefinition-
The member. May not be null.
Returns
- bool
-
true if item is successfully removed; otherwise, false.
RemoveSerializationMember(Type, JsonOptions, MemberDefinition)
Removes a serialization member.
public static bool RemoveSerializationMember(Type type, JsonOptions options, MemberDefinition member)
Parameters
type
Type-
The type. May not be null.
options
JsonOptions-
The options. May be null.
member
MemberDefinition-
The member. May not be null.
Returns
- bool
-
true if item is successfully removed; otherwise, false.
ToString()
Returns a System.String that represents this instance.
public override string ToString()
Returns
- string
-
A System.String that represents this instance.
UsingLock<T>(Action<T>, T)
Run a specified action, using the member definition lock.
public static void UsingLock<T>(Action<T> action, T state)
Parameters
action
Action<T>-
The action. May not be null.
state
T-
The state. May be null.
Type Parameters
T
-
The action input type.