Show / Hide Table of Contents

Class BsonManipulator

Inheritance
System.Object
BsonManipulator
Namespace: Eco.Shared.Serialization
Assembly: Eco.Shared.dll
Syntax
public static class BsonManipulator : Object

Methods

DecodeArgs(BSONArray, Type[])

Declaration
public static object[] DecodeArgs(BSONArray bson, Type[] schema)
Parameters
Type Name Description
BSONArray bson
System.Type[] schema
Returns
Type Description
System.Object[]

EncodeArgs(INetClient, Object[])

Declaration
public static BSONArray EncodeArgs(INetClient client, params object[] args)
Parameters
Type Name Description
INetClient client
System.Object[] args
Returns
Type Description
BSONArray

FromBson(BSONValue, Type)

Declaration
public static object FromBson(BSONValue value, Type type)
Parameters
Type Name Description
BSONValue value
System.Type type
Returns
Type Description
System.Object

FromBson<T>(BSONValue)

Declaration
public static T FromBson<T>(BSONValue value)
Parameters
Type Name Description
BSONValue value
Returns
Type Description
T
Type Parameters
Name Description
T

FromBson2DArray(BSONObject)

Declaration
public static int[, ] FromBson2DArray(BSONObject bson)
Parameters
Type Name Description
BSONObject bson
Returns
Type Description
System.Int32[,]

FromBsonToDictionary(BSONObject, IDictionary, Type, Type)

Deserializes obj to dictionary. dictionary elements will be replaced with new elements from BSON.

Declaration
public static void FromBsonToDictionary(BSONObject obj, IDictionary dictionary, Type keyType, Type valueType)
Parameters
Type Name Description
BSONObject obj
System.Collections.IDictionary dictionary
System.Type keyType
System.Type valueType

FromBsonToDictionary<TKey, TValue>(BSONObject, IDictionary<TKey, TValue>)

Deserializes obj to dictionary. dictionary elements will be replaced with new elements from BSON.

Declaration
public static void FromBsonToDictionary<TKey, TValue>(BSONObject obj, IDictionary<TKey, TValue> dictionary)
Parameters
Type Name Description
BSONObject obj
System.Collections.Generic.IDictionary<TKey, TValue> dictionary
Type Parameters
Name Description
TKey
TValue

GetListConvertorFromBson(Type)

Declaration
public static MethodInfo GetListConvertorFromBson(Type type)
Parameters
Type Name Description
System.Type type
Returns
Type Description
System.Reflection.MethodInfo

MakeGenericDictionarySerializer<TKey, TValue>()

Makes generic dictionary lightweight (no reflection) delegate which just converts first argument from non-generic to generic dictionary and passes all other arguments.

Declaration
public static BsonManipulator.ToBsonDictionaryDelegate MakeGenericDictionarySerializer<TKey, TValue>()
Returns
Type Description
BsonManipulator.ToBsonDictionaryDelegate
Type Parameters
Name Description
TKey
TValue

ReflectionToBson(in BsonSerializationContext, Object)

Serialize all properties tagged with Serialized. If NO properties are tagged as such, serialize ALL properties instead.

Declaration
public static BSONValue ReflectionToBson(in BsonSerializationContext context, object val)
Parameters
Type Name Description
BsonSerializationContext context
System.Object val
Returns
Type Description
BSONValue

ToBson(IDictionary, in BsonSerializationContext, Boolean)

Declaration
public static BSONObject ToBson(this IDictionary dictionary, in BsonSerializationContext context = null, bool useReflection = false)
Parameters
Type Name Description
System.Collections.IDictionary dictionary
BsonSerializationContext context
System.Boolean useReflection
Returns
Type Description
BSONObject

ToBson(Int32[,])

Declaration
public static BSONObject ToBson(this int[, ] array)
Parameters
Type Name Description
System.Int32[,] array
Returns
Type Description
BSONObject

ToBson(Object, in BsonSerializationContext, Boolean)

Declaration
public static BSONValue ToBson(object val, in BsonSerializationContext context = null, bool useReflection = false)
Parameters
Type Name Description
System.Object val
BsonSerializationContext context
System.Boolean useReflection
Returns
Type Description
BSONValue

ToBsonDictionary<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>>, in BsonSerializationContext, Boolean)

Serializes enumerable of key-value pairs as BSON dictionary.

Declaration
public static BSONObject ToBsonDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> dictionary, in BsonSerializationContext context = null, bool useReflection = false)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>> dictionary
BsonSerializationContext context
System.Boolean useReflection
Returns
Type Description
BSONObject
Type Parameters
Name Description
TKey
TValue
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾