/// <summary> /// Registers a specified ITypeSerializer to a custom type serializer implementation. /// </summary> /// <param name="sourceInterface">The ITypeSerializer to register for.</param> /// <param name="implementation">The ITypeSerializer implementation to register against.</param> internal IBindingWhenInNamedWithOrOnSyntax <object> RegisterTypeSerializer(Type sourceInterface, Type implementation) { var bindingSyntax = Kernel.Rebind(sourceInterface).To(implementation); if (!RegisteredTypeSerializers.Contains(sourceInterface)) { RegisteredTypeSerializers.Add(sourceInterface); } BindITypeSerializationFactory(); return(bindingSyntax); }
/// <summary> /// Unregisters the custom ITypeSerializer linked to Type. /// </summary> /// <typeparam name="T">The Type to unregister the customer ITypeSerializer for.</typeparam> public virtual void UnRegisterType <T>() { var type = typeof(ITypeSerializer <T>); if (RegisteredTypeSerializers.Contains(type)) { Kernel.Unbind(type); RegisteredTypeSerializers.Remove(type); BindITypeSerializationFactory(); } }