Represents configuration for pre-generated serializer assembly generation.
Inheritance: ISerializerGeneratorConfiguration
Exemplo n.º 1
0
 /// <summary>
 ///		Generates an assembly which contains auto-generated serializer types for specified types.
 /// </summary>
 /// <param name="configuration">The <see cref="SerializerAssemblyGenerationConfiguration"/> which holds required <see cref="SerializerAssemblyGenerationConfiguration.AssemblyName"/> and optional settings.</param>
 /// <param name="targetTypes">The target types where serializer types to be generated.</param>
 /// <returns>The file path for generated single module assembly file.</returns>
 /// <exception cref="ArgumentNullException"><paramref name="configuration"/> is <c>null</c>. Or, <paramref name="targetTypes"/> is <c>null</c>.</exception>
 /// <exception cref="InvalidOperationException"><see cref="SerializerAssemblyGenerationConfiguration.AssemblyName"/> of <paramref name="configuration"/> is not set correctly.</exception>
 /// <exception cref="System.Runtime.Serialization.SerializationException">Failed to generate a serializer because of <paramref name="targetTypes"/>.</exception>
 /// <remarks>
 ///		Serializer types for dependent types which are refered from specified <paramref name="targetTypes"/> are automatically generated.
 /// </remarks>
 public static string GenerateAssembly(SerializerAssemblyGenerationConfiguration configuration, IEnumerable <Type> targetTypes)
 {
     return
         (Path.GetFullPath(
              Path.Combine(
                  configuration == null ? "." : configuration.OutputDirectory,
                  new SerializerAssemblyGenerationLogic().Generate(targetTypes, configuration).Single()
                  )
              ));
 }
Exemplo n.º 2
0
 /// <summary>
 ///		Generates an assembly which contains auto-generated serializer types for specified types.
 /// </summary>
 /// <param name="configuration">The <see cref="SerializerAssemblyGenerationConfiguration"/> which holds required <see cref="SerializerAssemblyGenerationConfiguration.AssemblyName"/> and optional settings.</param>
 /// <param name="targetTypes">The target types where serializer types to be generated.</param>
 /// <returns>
 ///		A <see cref="SerializerCodeGenerationResult"/> collection which correspond to codes generated to <paramref name="targetTypes"/>.
 ///		All <see cref="SerializerCodeGenerationResult.FilePath"/> properties of items will be same and will point to generated DLL file.
 /// </returns>
 /// <exception cref="ArgumentNullException"><paramref name="configuration"/> is <c>null</c>. Or, <paramref name="targetTypes"/> is <c>null</c>.</exception>
 /// <exception cref="InvalidOperationException"><see cref="SerializerAssemblyGenerationConfiguration.AssemblyName"/> of <paramref name="configuration"/> is not set correctly.</exception>
 /// <exception cref="System.Runtime.Serialization.SerializationException">Failed to generate a serializer because of <paramref name="targetTypes"/>.</exception>
 /// <remarks>
 ///		Serializer types for dependent types which are refered from specified <paramref name="targetTypes"/> are automatically generated.
 /// </remarks>
 public static IEnumerable <SerializerCodeGenerationResult> GenerateSerializerCodeAssembly(SerializerAssemblyGenerationConfiguration configuration, IEnumerable <Type> targetTypes)
 {
     return(new SerializerAssemblyGenerationLogic().Generate(targetTypes, configuration));
 }
Exemplo n.º 3
0
 /// <summary>
 ///		Generates an assembly which contains auto-generated serializer types for specified types.
 /// </summary>
 /// <param name="configuration">The <see cref="SerializerAssemblyGenerationConfiguration"/> which holds required <see cref="SerializerAssemblyGenerationConfiguration.AssemblyName"/> and optional settings.</param>
 /// <param name="targetTypes">The target types where serializer types to be generated.</param>
 /// <returns>
 ///		A <see cref="SerializerCodeGenerationResult"/> collection which correspond to codes generated to <paramref name="targetTypes"/>.
 ///		All <see cref="SerializerCodeGenerationResult.FilePath"/> properties of items will be same and will point to generated DLL file.
 /// </returns>
 /// <exception cref="ArgumentNullException"><paramref name="configuration"/> is <c>null</c>. Or, <paramref name="targetTypes"/> is <c>null</c>.</exception>
 /// <exception cref="InvalidOperationException"><see cref="SerializerAssemblyGenerationConfiguration.AssemblyName"/> of <paramref name="configuration"/> is not set correctly.</exception>
 /// <exception cref="System.Runtime.Serialization.SerializationException">Failed to generate a serializer because of <paramref name="targetTypes"/>.</exception>
 /// <remarks>
 ///		Serializer types for dependent types which are refered from specified <paramref name="targetTypes"/> are automatically generated.
 /// </remarks>
 public static IEnumerable <SerializerCodeGenerationResult> GenerateSerializerCodeAssembly(SerializerAssemblyGenerationConfiguration configuration, params Type[] targetTypes)
 {
     return(GenerateSerializerCodeAssembly(configuration, targetTypes as IEnumerable <Type>));
 }
Exemplo n.º 4
0
        /// <summary>
        ///		Generates an assembly which contains auto-generated serializer types for specified types.
        /// </summary>
        /// <param name="configuration">The <see cref="SerializerAssemblyGenerationConfiguration"/> which holds required <see cref="SerializerAssemblyGenerationConfiguration.AssemblyName"/> and optional settings.</param>
        /// <param name="targetTypes">The target types where serializer types to be generated.</param>
        /// <returns>The file path for generated single module assembly file.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="configuration"/> is <c>null</c>. Or, <paramref name="targetTypes"/> is <c>null</c>.</exception>
        /// <exception cref="InvalidOperationException"><see cref="SerializerAssemblyGenerationConfiguration.AssemblyName"/> of <paramref name="configuration"/> is not set correctly.</exception>
        /// <exception cref="System.Runtime.Serialization.SerializationException">Failed to generate a serializer because of <paramref name="targetTypes"/>.</exception>
        /// <remarks>
        ///		Serializer types for dependent types which are refered from specified <paramref name="targetTypes"/> are automatically generated.
        /// </remarks>
        public static string GenerateAssembly(SerializerAssemblyGenerationConfiguration configuration, IEnumerable <Type> targetTypes)
        {
            var firstEntry = GenerateSerializerCodeAssembly(configuration, targetTypes).FirstOrDefault();

            return(firstEntry == null ? null : firstEntry.FilePath);
        }
Exemplo n.º 5
0
 /// <summary>
 ///		Generates an assembly which contains auto-generated serializer types for specified types.
 /// </summary>
 /// <param name="configuration">The <see cref="SerializerAssemblyGenerationConfiguration"/> which holds required <see cref="SerializerAssemblyGenerationConfiguration.AssemblyName"/> and optional settings.</param>
 /// <param name="targetTypes">The target types where serializer types to be generated.</param>
 /// <returns>The file path for generated single module assembly file.</returns>
 /// <exception cref="ArgumentNullException"><paramref name="configuration"/> is <c>null</c>. Or, <paramref name="targetTypes"/> is <c>null</c>.</exception>
 /// <exception cref="InvalidOperationException"><see cref="SerializerAssemblyGenerationConfiguration.AssemblyName"/> of <paramref name="configuration"/> is not set correctly.</exception>
 /// <exception cref="System.Runtime.Serialization.SerializationException">Failed to generate a serializer because of <paramref name="targetTypes"/>.</exception>
 /// <remarks>
 ///		Serializer types for dependent types which are refered from specified <paramref name="targetTypes"/> are automatically generated.
 /// </remarks>
 public static string GenerateAssembly(SerializerAssemblyGenerationConfiguration configuration, params Type[] targetTypes)
 {
     return(GenerateAssembly(configuration, targetTypes as IEnumerable <Type>));
 }