protected override void Init(Type recordType) { base.Init(recordType); ChoFileRecordObjectAttribute recObjAttr = ChoType.GetAttribute <ChoFileRecordObjectAttribute>(recordType); if (recObjAttr != null) { if (recObjAttr.BufferSize > 0) { BufferSize = recObjAttr.BufferSize; } if (recObjAttr.Comments.IsNullOrWhiteSpace()) { Comments = new string[] { } } ; else { Comments = recObjAttr.Comments.SplitNTrim(','); } Culture = recObjAttr.Culture; EOLDelimiter = recObjAttr.EOLDelimiter; IgnoreEmptyLine = recObjAttr.IgnoreEmptyLine; ColumnCountStrict = recObjAttr.ColumnCountStrict; ColumnOrderStrict = recObjAttr.ColumnOrderStrict; QuoteChar = recObjAttr.QuoteChar; QuoteAllFields = recObjAttr.QuoteAllFields; StringSplitOptions = recObjAttr.StringSplitOptions; if (!recObjAttr.Encoding.IsNullOrWhiteSpace()) { Encoding = Encoding.GetEncoding(recObjAttr.Encoding); } } }
protected virtual void Init(Type recordType) { ChoFileRecordObjectAttribute recObjAttr = ChoType.GetAttribute <ChoFileRecordObjectAttribute>(recordType); if (recObjAttr != null) { ErrorMode = recObjAttr.ErrorMode; IgnoreFieldValueMode = recObjAttr.IgnoreFieldValueMode; if (recObjAttr.BufferSize > 0) { BufferSize = recObjAttr.BufferSize; } if (recObjAttr.Comments.IsNullOrWhiteSpace()) { Comments = new string[] { } } ; else { Comments = recObjAttr.Comments.SplitNTrim(','); } Culture = recObjAttr.Culture; EOLDelimiter = recObjAttr.EOLDelimiter; IgnoreEmptyLine = recObjAttr.IgnoreEmptyLine; ColumnCountStrict = recObjAttr.ColumnCountStrict; QuoteChar = recObjAttr.QuoteChar; QuoteAllFields = recObjAttr.QuoteAllFields; StringSplitOptions = recObjAttr.StringSplitOptions; Encoding = recObjAttr.Encoding.CastTo <Encoding>(Encoding); } }
protected override void Init(Type recordType) { base.Init(recordType); if (recordType == null) { return; } ChoFileRecordObjectAttribute recObjAttr = ChoType.GetAttribute <ChoFileRecordObjectAttribute>(recordType); if (recObjAttr != null) { AutoDiscoverFieldTypes = true; MaxScanRows = 0; if (recObjAttr.BufferSize > 0) { BufferSize = recObjAttr.BufferSize; } if (recObjAttr.Comments.IsNullOrWhiteSpace()) { Comments = new string[] { } } ; else { Comments = recObjAttr.Comments.SplitNTrim(','); } Culture = recObjAttr.Culture; EOLDelimiter = recObjAttr.EOLDelimiter; IgnoreEmptyLine = recObjAttr.IgnoreEmptyLine; ColumnCountStrict = recObjAttr.ColumnCountStrict; ColumnOrderStrict = recObjAttr.ColumnOrderStrict; QuoteChar = recObjAttr.QuoteChar; QuoteAllFields = recObjAttr.QuoteAllFields; StringSplitOptions = recObjAttr.StringSplitOptions; if (!recObjAttr.Encoding.IsNullOrWhiteSpace()) { Encoding = Encoding.GetEncoding(recObjAttr.Encoding); } TreatCurrencyAsDecimal = recObjAttr.TreatCurrencyAsDecimal; NullValue = recObjAttr.NullValue; } }
private ChoFileRecordConfiguration GetConfiguration(Type recordType) { ChoFileRecordConfiguration config = Configuration[recordType]; if (config == null) { ChoFileRecordObjectAttribute recObjAttr = ChoType.GetAttribute <ChoFileRecordObjectAttribute>(recordType); if (recObjAttr == null || recObjAttr is ChoCSVRecordObjectAttribute) { Configuration[recordType] = new ChoCSVRecordConfiguration(recordType); } else if (recObjAttr is ChoFixedLengthRecordObjectAttribute) { Configuration[recordType] = new ChoFixedLengthRecordConfiguration(recordType); } } return(Configuration[recordType]); }