Esempio n. 1
0
        /// <summary>
        ///		Builds the serializer code using specified code generation context.
        /// </summary>
        /// <param name="context">
        ///		The <see cref="ISerializerCodeGenerationContext"/> which holds configuration and stores generated code constructs.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///		<paramref name="context"/> is <c>null</c>.
        /// </exception>
        /// <exception cref="NotSupportedException">
        ///		This class does not support code generation.
        /// </exception>
        /// <remarks>
        ///		This method will not do anything when <see cref="ISerializerCodeGenerationContext.BuiltInSerializerExists"/> returns <c>true</c> for <typeparamref name="TObject"/>.
        /// </remarks>
        public void BuildSerializerCode(ISerializerCodeGenerationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (context.BuiltInSerializerExists(typeof(TObject)))
            {
                // nothing to do.
                return;
            }

            this.BuildSerializerCodeCore(context);
        }
        /// <summary>
        ///		Builds the serializer code using specified code generation context.
        /// </summary>
        /// <param name="context">
        ///		The <see cref="ISerializerCodeGenerationContext"/> which holds configuration and stores generated code constructs.
        /// </param>
        /// <param name="concreteType">The substitution type if <typeparamref name="TObject"/> is abstract type. <c>null</c> when <typeparamref name="TObject"/> is not abstract type.</param>
        /// <param name="itemSchema">The schema which contains schema for collection items, dictionary keys, or tuple items. This value must not be <c>null</c>.</param>
        /// <exception cref="ArgumentNullException">
        ///		<paramref name="context"/> is <c>null</c>.
        /// </exception>
        /// <exception cref="NotSupportedException">
        ///		This class does not support code generation.
        /// </exception>
        /// <remarks>
        ///		This method will not do anything when <see cref="ISerializerCodeGenerationContext.BuiltInSerializerExists"/> returns <c>true</c> for <typeparamref name="TObject"/>.
        /// </remarks>
        public void BuildSerializerCode(ISerializerCodeGenerationContext context, Type concreteType, PolymorphismSchema itemSchema)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (context.BuiltInSerializerExists(typeof(TObject)))
            {
                // nothing to do.
                return;
            }

            this.BuildSerializerCodeCore(context, concreteType, itemSchema);
        }