/// <summary> /// Initializes new instance of <see cref="T:NCoreUtils.Serialization.TypeSerializerFactory" /> with the /// specified accessor selector. /// </summary> /// <param name="defaultAccessorSelector">Accessor selector to be used as default.</param> public TypeSerializerFactory(IAccessorSelector defaultAccessorSelector) { _defaultAccessorSelector = defaultAccessorSelector; _primitiveSerializers = ImmutableDictionary.CreateRange(new KeyValuePair <Type, TypeSerializer>[] { new KeyValuePair <Type, TypeSerializer>(typeof(bool), new BooleanSerializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(sbyte), new SByteSerializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(short), new Int16Serializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(int), new Int32Serializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(long), new Int64Serializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(byte), new ByteSerializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(ushort), new UInt16Serializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(uint), new UInt32Serializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(ulong), new UInt64Serializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(float), new SingleSerializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(double), new DoubleSerializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(decimal), new DecimalSerializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(char), new CharSerializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(string), new StringSerializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(DateTime), new DateTimeSerializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(DateTimeOffset), new DateTimeOffsetSerializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(Guid), new GuidSerializer(this)), new KeyValuePair <Type, TypeSerializer>(typeof(CaseInsensitive), new CaseInsensitiveSerializer(this)) }); }
/// <summary> /// Initializes new instance of <see cref="T:NCoreUtils.Serialization.CachedTypeSerializerFactory" /> with the /// specified accessor selector. /// </summary> /// <param name="defaultAccessorSelector">Accessor selector to use.</param> public CachedTypeSerializerFactory(IAccessorSelector defaultAccessorSelector) : base(defaultAccessorSelector) { _typeSerializerFactory = base.GetSerializer; }