Show / Hide Table of Contents

Namespace Eco.Shared.Serialization

Classes

BSONArray

Array of BSONValue items. Used in binary serialization while data transfer data between client and server. It implements List like behavior based on shared array pool instead of backing List for better memory utilization. If we use a List then it will never drop in Capacity, eventually all lists in BSONArray will grow to match bigger capacity needed for often used arrays. I.e. if we transfer BSON array with size 100 once per second and use 100 BSONArray objects then:

  • with lists every time when BSONArray created (actually rented from pool) it may be a different BSONArray and it will be filled with 100 items even if all other BSON arrays we use need just 2-10 items. Now we have 100x100 = 10 000 capacity allocated and never released.
  • with array pools it will use same array from shared pool every time when BSONArray need to accept 100 items (assuming we don't have two BSON arrays of that size in parallel). All other arrays not exceed 10 items so we have just 100 + 99x10 = 1 090 capacity allocated instead of 10 000.

BsonAutoSerializeAttribute

Mark a partial class or struct to implement IBsonSerialize using automatic source generator

BSONCachedValue

BSONCachedValue may be used to cache any other BSONValue and to be used in place of it. Cached BSONValue will be pre-serialized to byte array and helps to save serialization time. When decoded it will be deserialized as a cached BSONValue. There no need for additional handling on receiving side.

BsonManipulator

BsonManipulator.ToBsonDictionaryDelegate

BsonManualSerializeAttribute

Mark a class or struct to indicate to BsonSerializeGenerator that it implements IBsonSerialize manually. Mainly used for BSONObject which has a unique implementation.

BSONObject

BsonSerializationContext

This is used when you send views to some client. Client is necesary to bind to him controllers and to get right value for params PropertyName(Player player). RelatedControllers are used for caching system, so when you cache some view it will be known which exact controllers you should package too (otherwise you could get cached value that refers not-existed at your side controllers).

BsonSerializeIgnoreAttribute

Mark a property or field as ignored by IBsonSerialize automatic source generator

BSONSimpleValue

Represents simple value (like float, double, int, string etc).

BSONSimpleValue.BlittableDateTime

BSONValue

Base class for BSONSimpleValue, BSONArray and BSONObject.

BSONValue<T>

BsonValueBackgroundRecycler

BSON Values background recycler. RecycleInBackground(BSONValue) may be used to move BSONValue recycling out of executing thread to save CPU resources where it is critical.

BSONValueFactoriesManager

BSONValueType

Value type of BSONValue. BSONValue may be used to store different value types and with that enum they may be distinguished.

ForceSerializeFullObjectAttribute

Used in conjunction with SerializedAttribute to designate that a member needs to be fully saved, not using references. For objects that use IHasReferenceableSerializableID

JsonIgnoreAttribute

JsonSerializeUtil

JsonUseAttribute

Overrides default strategy for ExpandableObjectContractResolver, it will use this attribute even if read-only and serializeReadOnlyProperties == false.

OnDeserializedAttribute

OnPostLoadAttribute

SerializedAsEnumerableAttribute

Custom types serialized as enumerable collections (like Dictionary or List) should have that attribute.

SerializedAttribute

This symbol will be serialized to BSON for storage in the world file.

SerializedDerivedAttribute

Will be serialized to BSON for storage in the world file, and applies to all derived classes too.

SerializedWithAttribute

SerializesTypeAttribute

Specify that this class serializes specific object types that might not otherwise be determined through reflection.

SharedBSONObject

Use this object if you have to share bson object. I.e. Player.animationData stored as shared object and then delivered to all clients. It keeps tracking of all object references and only recycle object when all references recycled.

SimpleBSON

ThreadSafeAttribute

When serializing some types, such as enumerables, the enumeration must not change - to enforce this, some designate "threadsafe" objects use this attribute, such as the immutable collections. When using this attribute manually, proper locking and other checks must be used the ensure thread safety - in general, use the ThreadSafe collections, but if you are SURE that your container is thread safe, go ahead and add this attribute.

UsesReferenceInHashCode

Used when a class needs references resolved before it can calculate its hashcode.

Interfaces

IBsonDeserializable

Adds support for deserializing from a BSONArray instance. Should not be implemented manually, instead use BsonAutoSerializeAttribute

IBsonSerializable

Adds support for serializing to a BSONArray instance. Should not be implemented manually, instead use BsonAutoSerializeAttribute

IBsonSerialize

Adds support for serializing and deserializing from a BSONArray instance. Should not be implemented manually, instead use BsonAutoSerializeAttribute

☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾