Table of Contents

Class TypeDef

Namespace
Alis.Core.Aspect.Data.Json
Assembly
Alis.dll

The type def class

internal sealed class TypeDef

Inheritance

Inherited Members

Constructors

TypeDef(Type, JsonOptions)

Initializes a new instance of the Alis.Core.Aspect.Data.Json.TypeDef class

internal TypeDef(Type type, JsonOptions options)

Parameters

type Type

The type

options JsonOptions

The options

Fields

Defs

The type def

internal static readonly Dictionary<string, TypeDef> Defs

Field Value

Dictionary<string, TypeDef>

KeyType

The key value type

internal static readonly Dictionary<Type, KeyValueType> KeyType

Field Value

Dictionary<Type, KeyValueType>

LockField

The lock

internal static readonly object LockField

Field Value

object

_deserializationMembers

The member definition

internal readonly List<MemberDefinition> _deserializationMembers

Field Value

List<MemberDefinition>

_serializationMembers

The member definition

internal readonly List<MemberDefinition> _serializationMembers

Field Value

List<MemberDefinition>

_type

The type

internal readonly Type _type

Field Value

Type

Methods

AddDeserializationMember(Type, JsonOptions, MemberDefinition)

Adds the deserialization member using the specified type

public static void AddDeserializationMember(Type type, JsonOptions options, MemberDefinition member)

Parameters

type Type

The type

options JsonOptions

The options

member MemberDefinition

The member

AddSerializationMember(Type, JsonOptions, MemberDefinition)

Adds the serialization member using the specified type

public static void AddSerializationMember(Type type, JsonOptions options, MemberDefinition member)

Parameters

type Type

The type

options JsonOptions

The options

member MemberDefinition

The member

ApplyEntry(IDictionary, object, string, object, JsonOptions)

Applies the entry using the specified dictionary

public void ApplyEntry(IDictionary dictionary, object target, string key, object value, JsonOptions options)

Parameters

dictionary IDictionary

The dictionary

target object

The target

key string

The key

value object

The value

options JsonOptions

The options

CheckJsonAttribute(bool, PropertyInfo, JsonOptions)

Describes whether check json attribute

internal static bool CheckJsonAttribute(bool serialization, PropertyInfo info, JsonOptions options)

Parameters

serialization bool

The serialization

info PropertyInfo

The info

options JsonOptions

The options

Returns

bool

The bool

CheckJsonAttribute(bool, PropertyDescriptor, JsonOptions)

Describes whether check json attribute

internal static bool CheckJsonAttribute(bool serialization, PropertyDescriptor descriptor, JsonOptions options)

Parameters

serialization bool

The serialization

descriptor PropertyDescriptor

The descriptor

options JsonOptions

The options

Returns

bool

The bool

CheckScriptIgnore(PropertyInfo, JsonOptions)

Describes whether check script ignore

internal static bool CheckScriptIgnore(PropertyInfo info, JsonOptions options)

Parameters

info PropertyInfo

The info

options JsonOptions

The options

Returns

bool

The bool

CheckScriptIgnore(PropertyDescriptor, JsonOptions)

Describes whether check script ignore

internal static bool CheckScriptIgnore(PropertyDescriptor descriptor, JsonOptions options)

Parameters

descriptor PropertyDescriptor

The descriptor

options JsonOptions

The options

Returns

bool

The bool

CheckSerialization(bool, PropertyInfo)

Describes whether check serialization

internal static bool CheckSerialization(bool serialization, PropertyInfo info)

Parameters

serialization bool

The serialization

info PropertyInfo

The info

Returns

bool

The bool

CheckSkipGetOnly(PropertyDescriptor, JsonOptions)

Describes whether check skip get only

internal static bool CheckSkipGetOnly(PropertyDescriptor descriptor, JsonOptions options)

Parameters

descriptor PropertyDescriptor

The descriptor

options JsonOptions

The options

Returns

bool

The bool

CheckXmlIgnoreAttribute(PropertyInfo, JsonOptions)

Describes whether check xml ignore attribute

internal static bool CheckXmlIgnoreAttribute(PropertyInfo info, JsonOptions options)

Parameters

info PropertyInfo

The info

options JsonOptions

The options

Returns

bool

The bool

CheckXmlIgnoreAttribute(PropertyDescriptor, JsonOptions)

Describes whether check xml ignore attribute

internal static bool CheckXmlIgnoreAttribute(PropertyDescriptor descriptor, JsonOptions options)

Parameters

descriptor PropertyDescriptor

The descriptor

options JsonOptions

The options

Returns

bool

The bool

CompareWireName(MemberDefinition, string)

Compares the wire name with the specified key.

internal static bool CompareWireName(MemberDefinition def, string key)

Parameters

def MemberDefinition

The member definition

key string

The key

Returns

bool

True if the wire name matches the key, false otherwise

CreateJsonEventArgs(TextWriter, object, IDictionary<object, object>, JsonOptions, bool, string, object)

Creates the json event args using the specified writer

internal static JsonEventArgs CreateJsonEventArgs(TextWriter writer, object component, IDictionary<object, object> objectGraph, JsonOptions options, bool first, string name, object value)

Parameters

writer TextWriter

The writer

component object

The component

objectGraph IDictionary<object, object>

The object graph

options JsonOptions

The options

first bool

The first

name string

The name

value object

The value

Returns

JsonEventArgs

The

CreateMemberDefinition(bool, PropertyInfo)

Creates the member definition using the specified serialization

internal static MemberDefinition CreateMemberDefinition(bool serialization, PropertyInfo info)

Parameters

serialization bool

The serialization

info PropertyInfo

The info

Returns

MemberDefinition

The ma

CreateMemberDefinition(bool, FieldInfo, JsonOptions)

Creates the member definition using the specified serialization

internal static MemberDefinition CreateMemberDefinition(bool serialization, FieldInfo field, JsonOptions options)

Parameters

serialization bool

The serialization

field FieldInfo

The field

options JsonOptions

The options

Returns

MemberDefinition

The member definition

CreateMemberDefinition(bool, FieldInfo)

Creates the member definition using the specified serialization

internal static MemberDefinition CreateMemberDefinition(bool serialization, FieldInfo info)

Parameters

serialization bool

The serialization

info FieldInfo

The info

Returns

MemberDefinition

The member definition

CreateMemberDefinition(bool, PropertyDescriptor)

Creates the member definition using the specified serialization

internal static MemberDefinition CreateMemberDefinition(bool serialization, PropertyDescriptor descriptor)

Parameters

serialization bool

The serialization

descriptor PropertyDescriptor

The descriptor

Returns

MemberDefinition

The ma

CreateMemberDefinitionForField(bool, FieldInfo, JsonOptions)

Creates a member definition for the specified field.

internal static MemberDefinition CreateMemberDefinitionForField(bool serialization, FieldInfo field, JsonOptions options)

Parameters

serialization bool

The serialization

field FieldInfo

The field

options JsonOptions

The options

Returns

MemberDefinition

A member definition

CreateMemberDefinitionIfApplicable(bool, FieldInfo, JsonOptions)

Creates the member definition if applicable using the specified serialization

internal static MemberDefinition CreateMemberDefinitionIfApplicable(bool serialization, FieldInfo field, JsonOptions options)

Parameters

serialization bool

The serialization

field FieldInfo

The field

options JsonOptions

The options

Returns

MemberDefinition

The member definition

CreateMemberDefinitionInstance(FieldInfo, string)

Creates the member definition instance using the specified info

internal static MemberDefinition CreateMemberDefinitionInstance(FieldInfo info, string name)

Parameters

info FieldInfo

The info

name string

The name

Returns

MemberDefinition

The member definition

CreateMemberDefinitions(bool, IEnumerable<FieldInfo>, JsonOptions)

Creates the member definitions using the specified serialization

internal static IEnumerable<MemberDefinition> CreateMemberDefinitions(bool serialization, IEnumerable<FieldInfo> fields, JsonOptions options)

Parameters

serialization bool

The serialization

fields IEnumerable<FieldInfo>

The fields

options JsonOptions

The options

Returns

IEnumerable<MemberDefinition>

An enumerable of member definition

CreateMemberDefinitionsFromDescriptors(bool, IEnumerable<PropertyDescriptor>, JsonOptions)

Creates member definitions from the specified property descriptors.

internal static IEnumerable<MemberDefinition> CreateMemberDefinitionsFromDescriptors(bool serialization, IEnumerable<PropertyDescriptor> descriptors, JsonOptions options)

Parameters

serialization bool

The serialization

descriptors IEnumerable<PropertyDescriptor>

The property descriptors

options JsonOptions

The options

Returns

IEnumerable<MemberDefinition>

An enumerable of member definition

CreateMemberDefinitionsFromProperties(bool, IEnumerable<PropertyInfo>, JsonOptions)

Creates the member definitions from properties using the specified serialization

internal static IEnumerable<MemberDefinition> CreateMemberDefinitionsFromProperties(bool serialization, IEnumerable<PropertyInfo> properties, JsonOptions options)

Parameters

serialization bool

The serialization

properties IEnumerable<PropertyInfo>

The properties

options JsonOptions

The options

Returns

IEnumerable<MemberDefinition>

An enumerable of member definition

EnumerateDefinitionsUsingReflection(bool, Type, JsonOptions)

Enumerates the definitions using reflection.

internal static IEnumerable<MemberDefinition> EnumerateDefinitionsUsingReflection(bool serialization, Type type, JsonOptions options)

Parameters

serialization bool

The serialization

type Type

The type

options JsonOptions

The options

Returns

IEnumerable<MemberDefinition>

An enumerable of member definition

EnumerateDefinitionsUsingTypeDescriptors(bool, Type, JsonOptions)

Enumerates the definitions using type descriptors using the specified serialization

internal static IEnumerable<MemberDefinition> EnumerateDefinitionsUsingTypeDescriptors(bool serialization, Type type, JsonOptions options)

Parameters

serialization bool

The serialization

type Type

The type

options JsonOptions

The options

Returns

IEnumerable<MemberDefinition>

An enumerable of member definition

EnumerateFieldDefinitions(bool, Type, JsonOptions)

Enumerates the field definitions using reflection if SerializeFields option is enabled.

internal static IEnumerable<MemberDefinition> EnumerateFieldDefinitions(bool serialization, Type type, JsonOptions options)

Parameters

serialization bool

The serialization

type Type

The type

options JsonOptions

The options

Returns

IEnumerable<MemberDefinition>

An enumerable of member definition

EnumeratePropertyDefinitions(bool, Type, JsonOptions)

Enumerates the property definitions using reflection.

internal static IEnumerable<MemberDefinition> EnumeratePropertyDefinitions(bool serialization, Type type, JsonOptions options)

Parameters

serialization bool

The serialization

type Type

The type

options JsonOptions

The options

Returns

IEnumerable<MemberDefinition>

An enumerable of member definition

FindDeserializationMember(string)

Finds the deserialization member using the specified key.

internal MemberDefinition FindDeserializationMember(string key)

Parameters

key string

The key

Returns

MemberDefinition

The member definition

Get(Type, JsonOptions)

Gets the type

public static TypeDef Get(Type type, JsonOptions options)

Parameters

type Type

The type

options JsonOptions

The options

Returns

TypeDef

The type def

GetDeserializationMember(string)

Gets the deserialization member using the specified key

internal MemberDefinition GetDeserializationMember(string key)

Parameters

key string

The key

Returns

MemberDefinition

The member definition

GetDeserializationMembers(Type, JsonOptions)

Gets the deserialization members using the specified type

public static MemberDefinition[] GetDeserializationMembers(Type type, JsonOptions options)

Parameters

type Type

The type

options JsonOptions

The options

Returns

MemberDefinition[]

The member definition array

GetFieldsFromType(Type)

Gets the fields from the specified type.

internal static IEnumerable<FieldInfo> GetFieldsFromType(Type type)

Parameters

type Type

The type

Returns

IEnumerable<FieldInfo>

An enumerable of FieldInfo

GetKey(Type, JsonOptions)

Gets the key using the specified type

internal static string GetKey(Type type, JsonOptions options)

Parameters

type Type

The type

options JsonOptions

The options

Returns

string

The string

GetMemberValueAndName(MemberDefinition, object)

Gets the member value and name.

internal static (bool, string, object) GetMemberValueAndName(MemberDefinition member, object component)

Parameters

member MemberDefinition

The member

component object

The component

Returns

(bool, string, object)

The bool, string and object

GetPropertiesFromType(Type)

Gets the properties from the specified type.

internal static IEnumerable<PropertyInfo> GetPropertiesFromType(Type type)

Parameters

type Type

The type

Returns

IEnumerable<PropertyInfo>

An enumerable of PropertyInfo

GetPropertiesFromTypeDescriptor(Type)

Gets the properties from the specified type using TypeDescriptor.

internal static IEnumerable<PropertyDescriptor> GetPropertiesFromTypeDescriptor(Type type)

Parameters

type Type

The type

Returns

IEnumerable<PropertyDescriptor>

An enumerable of PropertyDescriptor

GetSerializationMembers(Type, JsonOptions)

Gets the serialization members using the specified type

public static MemberDefinition[] GetSerializationMembers(Type type, JsonOptions options)

Parameters

type Type

The type

options JsonOptions

The options

Returns

MemberDefinition[]

The member definition array

HandleCallback(TextWriter, object, IDictionary<object, object>, JsonOptions, bool, bool, string, object)

Handles the callback if present.

internal static (bool, bool, string, object) HandleCallback(TextWriter writer, object component, IDictionary<object, object> objectGraph, JsonOptions options, bool first, bool nameChanged, string name, object value)

Parameters

writer TextWriter

The writer

component object

The component

objectGraph IDictionary<object, object>

The object graph

options JsonOptions

The options

first bool

The first

nameChanged bool

The name changed

name string

The name

value object

The value

Returns

(bool, bool, string, object)

The bool, bool, string and object

HandleEvent(JsonEventArgs, bool, string, object)

Handles the event and returns updated values.

internal static (bool, bool, string, object) HandleEvent(JsonEventArgs e, bool first, string name, object value)

Parameters

e JsonEventArgs

The JsonEventArgs

first bool

The first

name string

The name

value object

The value

Returns

(bool, bool, string, object)

The bool, bool, string and object

HandleFieldSerialization(bool, Type, JsonOptions)

Handles the field serialization using the specified serialization

internal static IEnumerable<MemberDefinition> HandleFieldSerialization(bool serialization, Type type, JsonOptions options)

Parameters

serialization bool

The serialization

type Type

The type

options JsonOptions

The options

Returns

IEnumerable<MemberDefinition>

An enumerable of member definition

HandlePropertySerialization(bool, Type, JsonOptions)

Handles the property serialization using the specified serialization

internal static IEnumerable<MemberDefinition> HandlePropertySerialization(bool serialization, Type type, JsonOptions options)

Parameters

serialization bool

The serialization

type Type

The type

options JsonOptions

The options

Returns

IEnumerable<MemberDefinition>

An enumerable of member definition

HandleWriteNamedValueObjectCallback(TextWriter, object, IDictionary<object, object>, JsonOptions, MemberDefinition, bool)

Handles the write named value object callback using the specified writer

internal static (bool, bool, string, object) HandleWriteNamedValueObjectCallback(TextWriter writer, object component, IDictionary<object, object> objectGraph, JsonOptions options, MemberDefinition member, bool first)

Parameters

writer TextWriter

The writer

component object

The component

objectGraph IDictionary<object, object>

The object graph

options JsonOptions

The options

member MemberDefinition

The member

first bool

The first

Returns

(bool, bool, string, object)

The bool, bool, string and object

InvokeCallback(JsonOptions, JsonEventArgs)

Invokes the callback using the specified options

internal static void InvokeCallback(JsonOptions options, JsonEventArgs e)

Parameters

options JsonOptions

The options

e JsonEventArgs

The

InvokeCallback(TextWriter, object, IDictionary<object, object>, JsonOptions, bool, string, object)

Invokes the callback using the specified writer

internal static JsonEventArgs InvokeCallback(TextWriter writer, object component, IDictionary<object, object> objectGraph, JsonOptions options, bool first, string name, object value)

Parameters

writer TextWriter

The writer

component object

The component

objectGraph IDictionary<object, object>

The object graph

options JsonOptions

The options

first bool

The first

name string

The name

value object

The value

Returns

JsonEventArgs

The

IsKeyValuePairEnumerable(Type, out Type, out Type)

Describes whether is key value pair enumerable

public static bool IsKeyValuePairEnumerable(Type type, out Type keyType, out Type valueType)

Parameters

type Type

The type

keyType Type

The key type

valueType Type

The value type

Returns

bool

The bool

IsUsingJsonAttribute(JsonOptions)

Describes whether is using json attribute

internal static bool IsUsingJsonAttribute(JsonOptions options)

Parameters

options JsonOptions

The options

Returns

bool

The bool

IsXmlIgnoreAttributePresent(PropertyDescriptor)

Describes whether is xml ignore attribute present

internal static bool IsXmlIgnoreAttributePresent(PropertyDescriptor descriptor)

Parameters

descriptor PropertyDescriptor

The descriptor

Returns

bool

The bool

IsXmlIgnoreOptionSet(JsonOptions)

Describes whether is xml ignore option set

internal static bool IsXmlIgnoreOptionSet(JsonOptions options)

Parameters

options JsonOptions

The options

Returns

bool

The bool

LockMethod<T>(Action<T>, T)

Locks the action

public static void LockMethod<T>(Action<T> action, T state)

Parameters

action Action<T>

The action

state T

The state

Type Parameters

T

The

RemoveDeserializationMember(Type, JsonOptions, MemberDefinition)

Describes whether remove deserialization member

public static bool RemoveDeserializationMember(Type type, JsonOptions options, MemberDefinition member)

Parameters

type Type

The type

options JsonOptions

The options

member MemberDefinition

The member

Returns

bool

The bool

RemoveSerializationMember(Type, JsonOptions, MemberDefinition)

Describes whether remove serialization member

public static bool RemoveSerializationMember(Type type, JsonOptions options, MemberDefinition member)

Parameters

type Type

The type

options JsonOptions

The options

member MemberDefinition

The member

Returns

bool

The bool

SetDefaultValue(MemberDefinition, FieldInfo)

Sets the default value using the specified member definition

internal static void SetDefaultValue(MemberDefinition memberDefinition, FieldInfo info)

Parameters

memberDefinition MemberDefinition

The member definition

info FieldInfo

The info

SetWireNames(bool, MemberDefinition, string)

Sets the wire names using the specified serialization

internal static void SetWireNames(bool serialization, MemberDefinition memberDefinition, string name)

Parameters

serialization bool

The serialization

memberDefinition MemberDefinition

The member definition

name string

The name

ShouldCreateMemberDefinition(bool, FieldInfo, JsonOptions)

Describes whether should create member definition

internal static bool ShouldCreateMemberDefinition(bool serialization, FieldInfo field, JsonOptions options)

Parameters

serialization bool

The serialization

field FieldInfo

The field

options JsonOptions

The options

Returns

bool

The bool

ShouldCreateMemberDefinitionForField(bool, FieldInfo, JsonOptions)

Checks if a member definition should be created for the specified field.

internal static bool ShouldCreateMemberDefinitionForField(bool serialization, FieldInfo field, JsonOptions options)

Parameters

serialization bool

The serialization

field FieldInfo

The field

options JsonOptions

The options

Returns

bool

True if a member definition should be created, false otherwise

ShouldIgnoreAttribute(bool, JsonPropertyNameAttribute)

Describes whether should ignore attribute

internal static bool ShouldIgnoreAttribute(bool serialization, JsonPropertyNameAttribute attribute)

Parameters

serialization bool

The serialization

attribute JsonPropertyNameAttribute

The attribute

Returns

bool

The bool

ShouldIgnoreCustomAttribute(bool, JsonIgnoreAttribute)

Describes whether should ignore custom attribute

internal static bool ShouldIgnoreCustomAttribute(bool serialization, JsonIgnoreAttribute attribute)

Parameters

serialization bool

The serialization

attribute JsonIgnoreAttribute

The attribute

Returns

bool

The bool

ShouldSkipDefaultValues(JsonOptions, MemberDefinition, object)

Describes whether this instance should skip default values

internal bool ShouldSkipDefaultValues(JsonOptions options, MemberDefinition member, object value)

Parameters

options JsonOptions

The options

member MemberDefinition

The member

value object

The value

Returns

bool

The bool

ShouldSkipDescriptor(bool, PropertyDescriptor, JsonOptions)

Describes whether should skip descriptor

internal static bool ShouldSkipDescriptor(bool serialization, PropertyDescriptor descriptor, JsonOptions options)

Parameters

serialization bool

The serialization

descriptor PropertyDescriptor

The descriptor

options JsonOptions

The options

Returns

bool

The bool

ShouldSkipDueToJsonAttribute(bool, FieldInfo, JsonOptions)

Describes whether should skip due to json attribute

internal static bool ShouldSkipDueToJsonAttribute(bool serialization, FieldInfo info, JsonOptions options)

Parameters

serialization bool

The serialization

info FieldInfo

The info

options JsonOptions

The options

Returns

bool

The bool

ShouldSkipDueToScriptIgnoreAttribute(FieldInfo, JsonOptions)

Describes whether should skip due to script ignore attribute

internal static bool ShouldSkipDueToScriptIgnoreAttribute(FieldInfo info, JsonOptions options)

Parameters

info FieldInfo

The info

options JsonOptions

The options

Returns

bool

The bool

ShouldSkipDueToXmlIgnoreAttribute(FieldInfo, JsonOptions)

Describes whether should skip due to xml ignore attribute

internal static bool ShouldSkipDueToXmlIgnoreAttribute(FieldInfo info, JsonOptions options)

Parameters

info FieldInfo

The info

options JsonOptions

The options

Returns

bool

The bool

ShouldSkipField(bool, FieldInfo, JsonOptions)

Determines whether to skip the field during serialization/deserialization.

internal static bool ShouldSkipField(bool serialization, FieldInfo info, JsonOptions options)

Parameters

serialization bool

Indicates whether serialization is being performed.

info FieldInfo

The field information.

options JsonOptions

The JSON options.

Returns

bool

True if the field should be skipped, false otherwise.

ShouldSkipNullDateTimeValues(JsonOptions, MemberDefinition, object)

Describes whether this instance should skip null date time values

internal bool ShouldSkipNullDateTimeValues(JsonOptions options, MemberDefinition member, object value)

Parameters

options JsonOptions

The options

member MemberDefinition

The member

value object

The value

Returns

bool

The bool

ShouldSkipNullPropertyValues(JsonOptions, object)

Describes whether this instance should skip null property values

internal bool ShouldSkipNullPropertyValues(JsonOptions options, object value)

Parameters

options JsonOptions

The options

value object

The value

Returns

bool

The bool

ShouldSkipProperty(bool, PropertyInfo, JsonOptions)

Describes whether should skip property

internal static bool ShouldSkipProperty(bool serialization, PropertyInfo info, JsonOptions options)

Parameters

serialization bool

The serialization

info PropertyInfo

The info

options JsonOptions

The options

Returns

bool

The bool

ShouldSkipValue(JsonOptions, MemberDefinition, object)

Describes whether this instance should skip value

internal bool ShouldSkipValue(JsonOptions options, MemberDefinition member, object value)

Parameters

options JsonOptions

The options

member MemberDefinition

The member

value object

The value

Returns

bool

The bool

ShouldSkipZeroValueTypes(JsonOptions, MemberDefinition, object)

Describes whether this instance should skip zero value types

internal bool ShouldSkipZeroValueTypes(JsonOptions options, MemberDefinition member, object value)

Parameters

options JsonOptions

The options

member MemberDefinition

The member

value object

The value

Returns

bool

The bool

ToString()

Returns the string

public override string ToString()

Returns

string

The string

UnlockedGet(Type, JsonOptions)

Unlock the get using the specified type

internal static TypeDef UnlockedGet(Type type, JsonOptions options)

Parameters

type Type

The type

options JsonOptions

The options

Returns

TypeDef

The ta

WriteMemberValue(TextWriter, JsonOptions, MemberDefinition, bool, string, object, IDictionary<object, object>)

Writes the member value using the specified writer

internal void WriteMemberValue(TextWriter writer, JsonOptions options, MemberDefinition member, bool nameChanged, string name, object value, IDictionary<object, object> objectGraph)

Parameters

writer TextWriter

The writer

options JsonOptions

The options

member MemberDefinition

The member

nameChanged bool

The name changed

name string

The name

value object

The value

objectGraph IDictionary<object, object>

The object graph

WriteValues(TextWriter, object, IDictionary<object, object>, JsonOptions)

Writes the values using the specified writer

public void WriteValues(TextWriter writer, object component, IDictionary<object, object> objectGraph, JsonOptions options)

Parameters

writer TextWriter

The writer

component object

The component

objectGraph IDictionary<object, object>

The object graph

options JsonOptions

The options