internal ChoRecordConfiguration(Type recordType = null)
 {
     RecordType                 = recordType.GetUnderlyingType();
     ErrorMode                  = ChoErrorMode.ReportAndContinue;
     AutoDiscoverColumns        = true;
     ThrowAndStopOnMissingField = true;
     ObjectValidationMode       = ChoObjectValidationMode.Off;
     IsDynamicObject            = RecordType.IsDynamicType();
 }
Example #2
0
        internal ChoYamlRecordConfiguration(Type recordType) : base(recordType)
        {
            UseJsonSerialization = false;

            _yamlSerializerSettings = new Lazy <SerializerSettings>(() =>
            {
                var yamlSettings      = new SerializerSettings();
                yamlSettings.EmitTags = false;
                yamlSettings.ComparerForKeySorting = null;
                return(yamlSettings);
            });

            _yamlSerializer = new Lazy <SharpYaml.Serialization.Serializer>(() =>
            {
                return(new SharpYaml.Serialization.Serializer(YamlSerializerSettings));
            });

            _yamlTagMapAutoRegister = new Lazy <bool>(() =>
            {
                if (!TurnOffAutoRegisterTagMap)
                {
                    if (!RecordType.IsDynamicType())
                    {
                        RegisterYamlTagMapForType(RecordType);
                    }
                }
                return(true);
            });

            YamlRecordFieldConfigurations = new List <ChoYamlRecordFieldConfiguration>();

            if (recordType != null)
            {
                Init(recordType);
            }
        }