Skip to content

CSharpGeneratorSettings

Rico Suter edited this page Jun 11, 2019 · 16 revisions

Inherits from CodeGeneratorSettingsBase

Properties:

  • Namespace: The namespace of the generated classes
  • ClassStyle: Inpc (default) | Poco
  • RequiredPropertiesMustBeDefined (default: true)
  • GenerateDataAnnotations (default: true)
  • DateType (default: DateTime)
  • DateTimeType (default: DateTime)
  • TimeType (default: TimeSpan)
  • TimeSpanType (default: TimeSpan)
  • ArrayType (default: Collection)
  • DictionaryType (default: Dictionary)
  • GenerateImmutableArrayProperties
  • GenerateImmutableDictionaryProperties
  • HandleReferences: (default: false)
  • JsonConverters: Additional converter classes to apply to the serializer
  • JsonSerializerSettingsTransformationMethod: (default: null) A method to transform the serializer settings.

JsonSerializerSettingsTransformationMethod

For example, you can implement the following class and set the method to MyNamespace.SerializerSettings.TransformSettings:

namespace MyNamespace
{
    internal static class SerializerSettings
    {
        public static JsonSerializerSettings TransformSettings(
            JsonSerializerSettings settings)
        {
            settings.DateParseHandling = DateParseHandling.DateTimeOffset;
            return settings;
        }
    }
}
Clone this wiki locally