private void RegisterHooks(SerializerHooks hooks) { foreach (var hook in hooks.Hooks) { RegisterHook(hook); } }
internal DataSerializer(SerializerHooks hooks, IEnumerable <KeyValuePair <int, IDataSerializableFactory> > dataSerializableFactories, ILoggerFactory loggerFactory) { _logger = loggerFactory.CreateLogger <DataSerializer>(); RegisterHooks(hooks); if (dataSerializableFactories != null) { foreach (var entry in dataSerializableFactories) { Register(entry.Key, entry.Value); } } }
internal SerializationService(IInputOutputFactory inputOutputFactory, int version, IDictionary <int, IDataSerializableFactory> dataSerializableFactories, IDictionary <int, IPortableFactory> portableFactories, ICollection <IClassDefinition> classDefinitions, SerializerHooks hooks, IEnumerable <ISerializerDefinitions> definitions, bool checkClassDefErrors, IPartitioningStrategy partitioningStrategy, int initialOutputBufferSize, ILoggerFactory loggerFactory) { _logger = loggerFactory.CreateLogger <SerializationService>(); _inputOutputFactory = inputOutputFactory; GlobalPartitioningStrategy = partitioningStrategy; _outputBufferSize = initialOutputBufferSize; _bufferPoolThreadLocal = new BufferPoolThreadLocal(this); _portableContext = new PortableContext(this, version); // create data serializer (will be added as constant) var dataSerializer = new DataSerializer(hooks, dataSerializableFactories, loggerFactory); _dataSerializerAdapter = CreateSerializerAdapter <IIdentifiedDataSerializable>(dataSerializer); // create portable serializer (will be added as constant) _portableSerializer = new PortableSerializer(_portableContext, portableFactories); _portableSerializerAdapter = CreateSerializerAdapter <IPortable>(_portableSerializer); // create the serializer of null objects (will be added as constant) _nullSerializerAdapter = CreateSerializerAdapter <object>(new NullSerializer()); // create the serializable adapter (will be added as constant) _serializableSerializerAdapter = CreateSerializerAdapter <object>(new SerializableSerializer()); // add defined serializers foreach (var definition in definitions) { definition.AddSerializers(this); } // add constant serializers AddMoreSerializers(); // add class definitions RegisterClassDefinitions(classDefinitions, checkClassDefErrors); }
public SerializationServiceBuilder(ILoggerFactory loggerFactory) { _loggerFactory = loggerFactory; _hooks = new SerializerHooks(); }