Beispiel #1
0
        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);
            System.Threading.Thread.CurrentThread.CurrentCulture = Configuration.Culture;
        }
        public ChoKVPRecordReader(Type recordType, ChoKVPRecordConfiguration configuration) : base(recordType)
        {
            ChoGuard.ArgumentNotNull(configuration, "Configuration");
            Configuration = configuration;

            _callbackRecordFieldRead = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyRecordFieldRead>(recordType);
            _callbackFileRead        = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyFileRead>(recordType);
            _callbackRecordRead      = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyRecordRead>(recordType);

            _customKVPRecord = ChoMetadataObjectCache.CreateMetadataObject <IChoNotifyKVPRecordRead>(recordType);
            //Configuration.Validate();
        }
Beispiel #3
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.");
                        }
                    }
                }
            }
        }