public static void GetConcreteSerializer(
			SerializationContext context,
			PolymorphismSchema schema,
			Type abstractType,
			Type targetType,
			Type exampleType,
			out ICollectionInstanceFactory factory,
			out MessagePackSerializer serializer
		)
		{
			if ( abstractType == targetType )
			{
				throw SerializationExceptions.NewNotSupportedBecauseCannotInstanciateAbstractType( abstractType );
			}

			serializer = context.GetSerializer( targetType, schema );
			factory = serializer as ICollectionInstanceFactory;
			if ( factory == null && (serializer as IPolymorphicDeserializer) == null )
			{
				throw SerializationExceptions.NewIncompatibleCollectionSerializer( abstractType, serializer.GetType(), exampleType );
			}
		}
Exemple #2
0
        public static void GetConcreteSerializer(
            SerializationContext context,
            PolymorphismSchema schema,
            Type abstractType,
            Type targetType,
            Type exampleType,
            out ICollectionInstanceFactory factory,
            out MessagePackSerializer serializer
            )
        {
            if (abstractType == targetType)
            {
                throw SerializationExceptions.NewNotSupportedBecauseCannotInstanciateAbstractType(abstractType);
            }

            serializer = context.GetSerializer(targetType, schema);
            factory    = serializer as ICollectionInstanceFactory;
            if (factory == null && (serializer as IPolymorphicDeserializer) == null)
            {
                throw SerializationExceptions.NewIncompatibleCollectionSerializer(abstractType, serializer.GetType(), exampleType);
            }
        }