Table of Contents

Class QueryParameterSerializer

Namespace
TimeCockpit.Data.JsonConverters
Assembly
TimeCockpit.Data.dll

class having static members for serializing query parameters to / from JSON

public class QueryParameterSerializer
Inheritance
Object
QueryParameterSerializer
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()

Constructors

QueryParameterSerializer()

public QueryParameterSerializer()

Methods

FromJSON(String, Model)

Reads query parameters from a json string.

public static IEnumerable<QueryParameter> FromJSON(string json, Model model)

Parameters

json String

the JSON string representation.

model Model

The model.

Returns

IEnumerable<QueryParameter>

Returns the collection of query parameters.

GetJSONObjectType(Type, Boolean)

returns a string describing the object type

public static string GetJSONObjectType(Type type, bool serializeEntityObjects)

Parameters

type Type

the .net type.

serializeEntityObjects Boolean

true if entity objects should be serialized, false to only serialize guids.

Returns

String

Returns the string representing the object type.

GetObjectValue(String, JsonReader, Model)

Returns the value of a query parameter, given the type and the JToken value

public static object GetObjectValue(string type, JsonReader jr, Model model)

Parameters

type String

string type of the value

jr JsonReader

the reader to read from.

model Model

The model.

Returns

Object

returns the .net object

ReadJSON(JsonReader, Model)

Converts a json string to a query parameter collection

public static IEnumerable<QueryParameter> ReadJSON(JsonReader jsonReader, Model model)

Parameters

jsonReader JsonReader

the json string to parse

model Model

The model.

Returns

IEnumerable<QueryParameter>

returns an enumerable of QueryParameters

ToJSON(IEnumerable<QueryParameter>, Model, Boolean)

Writes query parameters to a string.

public static string ToJSON(IEnumerable<QueryParameter> queryParameters, Model model, bool serializeEntityObjects = false)

Parameters

queryParameters IEnumerable<QueryParameter>

query parameters to serialize.

model Model

The model.

serializeEntityObjects Boolean

True if EntityObjects should be serialized completely, false to only serialize the GUID.

Returns

String

Returns a string representation in JSON notation of the query parameters.

WriteJSON(JsonWriter, Model, IEnumerable<QueryParameter>, Boolean)

converts a collection of query parameters to json

public static void WriteJSON(JsonWriter jw, Model model, IEnumerable<QueryParameter> parameters, bool serializeEntityObjects = false)

Parameters

jw JsonWriter

json writer to write parameters to.

model Model

The base model.

parameters IEnumerable<QueryParameter>

the parameters to convert

serializeEntityObjects Boolean

true if entity objects should be serialized, false to only serialize guids.

WriteJSONObjectValue(Object, JsonWriter, Model, Boolean)

Gets a JSON compatible object value to store.

public static void WriteJSONObjectValue(object value, JsonWriter jw, Model model, bool serializeEntityObjects)

Parameters

value Object

the value to write.

jw JsonWriter

the writer to write the value to.

model Model

The model.

serializeEntityObjects Boolean

true if entity objects should be serialized, false to only serialize guids.

WriteJsonParameter(JsonWriter, Model, QueryParameter, Boolean)

Writes the json parameter.

public static void WriteJsonParameter(JsonWriter jw, Model model, QueryParameter parameter, bool serializeEntityObjects)

Parameters

jw JsonWriter

The json writer.

model Model

The base model.

parameter QueryParameter

the parameter to write.

serializeEntityObjects Boolean

true if entity objects should be serialized, false to only serialize guids.