Exemple #1
0
 public ChoHL7RecordReader(Type recordType, ChoHL7Configuration configuration) : base(recordType)
 {
     ChoGuard.ArgumentNotNull(configuration, "Configuration");
     Configuration   = configuration;
     _callbackRecord = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyRecordRead>(recordType);
     //Configuration.Validate();
 }
Exemple #2
0
 public ChoCSVRecordReader(Type recordType, ChoCSVRecordConfiguration configuration) : base(recordType)
 {
     ChoGuard.ArgumentNotNull(configuration, "Configuration");
     Configuration               = configuration;
     _callbackRecord             = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyRecordRead>(recordType);
     _customColumnMappableRecord = ChoMetadataObjectCache.CreateMetadataObject <IChoCustomColumnMappable>(recordType);
     _emptyLineReportableRecord  = ChoMetadataObjectCache.CreateMetadataObject <IChoEmptyLineReportable>(recordType);
     //Configuration.Validate();
 }
        public ChoParquetRecordReader(Type recordType, ChoParquetRecordConfiguration configuration) : base(recordType, false)
        {
            ChoGuard.ArgumentNotNull(configuration, "Configuration");
            Configuration = configuration;

            _callbackRecordFieldRead     = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyRecordFieldRead>(recordType);
            _callbackFileRead            = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyFileRead>(recordType);
            _callbackRecordRead          = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyRecordRead>(recordType);
            _callbackRecordSeriablizable = ChoMetadataObjectCache.CreateMetadataObject <IChoRecordFieldSerializable>(recordType);
        }
Exemple #4
0
        public ChoAvroRecordReader(Type recordType, ChoAvroRecordConfiguration configuration) : base(recordType, false)
        {
            ChoGuard.ArgumentNotNull(configuration, "Configuration");
            Configuration = configuration;

            _callbackRecordFieldRead     = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyRecordFieldRead>(recordType);
            _callbackFileRead            = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyFileRead>(recordType);
            _callbackRecordRead          = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyRecordRead>(recordType);
            _callbackRecordSeriablizable = ChoMetadataObjectCache.CreateMetadataObject <IChoRecordFieldSerializable>(recordType);
            System.Threading.Thread.CurrentThread.CurrentCulture = Configuration.Culture;
        }
Exemple #5
0
 public ChoKVPRecordReader(Type recordType, ChoKVPRecordConfiguration configuration) : base(recordType)
 {
     ChoGuard.ArgumentNotNull(configuration, "Configuration");
     Configuration        = configuration;
     _callbackRecord      = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyRecordRead>(recordType);
     _callbackFieldRecord = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyRecordFieldRead>(recordType);
     if (_callbackFieldRecord == null)
     {
         _callbackFieldRecord = _callbackRecord;
     }
     _customKVPRecord = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyKVPRecordRead>(recordType);
     //Configuration.Validate();
 }
Exemple #6
0
        public override void Validate(object state)
        {
            base.Validate(state);

            if (NotifyRecordReadType != null)
            {
                NotifyFileReadObject        = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyFileRead>(NotifyRecordReadType);
                NotifyRecordReadObject      = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyRecordRead>(NotifyRecordReadType);
                NotifyRecordFieldReadObject = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyRecordFieldRead>(NotifyRecordReadType);
            }
            if (NotifyRecordWriteType != null)
            {
                NotifyRecordWriteObject = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyRecordWrite>(NotifyRecordWriteType);
            }

            //if (SubRecordConfigurations.Count == 0)
            //    throw new ChoRecordConfigurationException("Atleast one record type must be registered.");

            foreach (Type t in SubRecordConfigurations.Keys)
            {
                if (SubRecordConfigurations[t] == null)
                {
                    throw new ChoRecordConfigurationException($"Missing record configuration for '{t.Name}' type.");
                }
            }

            if (RecordTypeConfiguration != null)
            {
                if (RecordSelector == null && RecordTypeCodeExtractor == null)
                {
                    if (RecordTypeConfiguration.StartIndex < 0)
                    {
                        throw new ChoRecordConfigurationException("RecordTypeConfiguration start index must be >= 0.");
                    }
                    else
                    {
                        if (RecordTypeConfiguration.Size <= 0)
                        {
                            throw new ChoRecordConfigurationException("RecordTypeConfiguration size must be > 0.");
                        }
                    }
                }
            }
        }