/// <summary> /// Create an engine on the record info provided /// </summary> /// <param name="ri">Record information</param> internal EngineBase(RecordInfo ri) { mRecordType = ri.RecordType; RecordInfo = ri; CreateRecordOptions(); }
/// <summary> /// Create and engine on type with specified encoding /// </summary> /// <param name="recordType">Class to base engine on</param> /// <param name="encoding">encoding of the file</param> internal EngineBase(Type recordType, Encoding encoding) { if (recordType == null) throw new BadUsageException(Messages.Errors.NullRecordClass.Text); if (recordType.IsValueType) throw new BadUsageException(Messages.Errors.StructRecordClass .RecordType(recordType.Name) .Text); mRecordType = recordType; mRecordInfo = RecordInfo.Resolve(recordType); // Container.Resolve<IRecordInfo>(recordType); mEncoding = encoding; CreateRecordOptions(); }
private void CompareRecordInfo(IRecordInfo recordInfo1, IRecordInfo recordInfo2) { var comp = new CompareObjects(); comp.CompareChildren = true; comp.ElementsToIgnore.Add("Cache"); comp.ElementsToIgnore.Add("RecordType"); comp.ElementsToIgnore.Add("FieldTypeInternal"); comp.ElementsToIgnore.Add("FieldInfo"); comp.ElementsToIgnore.Add("Operations"); comp.ElementsToIgnore.Add("FieldType"); comp.ElementsToIgnore.Add("TypeId"); comp.CompareFields = true; //comp.ComparePrivateFields = true; comp.ComparePrivateProperties = true; comp.CompareReadOnly = true; Check.That(comp.Compare(recordInfo1, recordInfo2)).IsTrue(); }
/// <summary> /// Create a set of operations for a particular type /// </summary> /// <param name="recordInfo">Record details we create objects off</param> public RecordOperations(IRecordInfo recordInfo) { RecordInfo = recordInfo; }
/// <summary> /// Converts any collection of records to a DataTable using reflection. /// If the number of records is 0 this methods returns an empty /// DataTable with the columns based on the fields of the /// Type. /// </summary> /// <param name="records">The records to be converted to a DataTable</param> /// <returns>The DataTable containing the records as DataRows</returns> /// <param name="maxRecords">The max number of records to add to the DataTable. -1 for all.</param> /// <param name="recordType">The type of the inner records.</param> public static DataTable RecordsToDataTable(ICollection records, Type recordType, int maxRecords) { IRecordInfo ri = RecordInfo.Resolve(recordType); return(ri.Operations.RecordsToDataTable(records, maxRecords)); }
/// <summary> /// This class allows you to set some options of the delimited records /// at runtime. With options the library is more flexible. /// </summary> /// <param name="info">Record information</param> internal DelimitedRecordOptions(IRecordInfo info) : base(info) { }
internal static RecordOptions CreateRecordOptionsCore(IRecordInfo info) { RecordOptions options; if (info.IsDelimited) options = new DelimitedRecordOptions(info); else options = new FixedRecordOptions(info); for (int index = 0; index < options.Fields.Count; index++) { var field = options.Fields[index]; field.Parent = options; field.ParentIndex = index; } return options; }
/// <summary> /// Deep copies content from src instance to this. /// <param name="source">Source for copy.</param> /// <returns>this.</returns> /// </summary> public new IntegralDataType CopyFrom(IRecordInfo source) { return((IntegralDataType)(this.CopyFromImpl(source))); }
/// <summary> /// Deep copies content from src instance to this. /// <param name="source">Source for copy.</param> /// <returns>this.</returns> /// </summary> protected override IRecordInterface CopyFromImpl(IRecordInfo source) { base.CopyFromImpl(source); if (typeof(IRecordClassDescriptorInfo).IsInstanceOfType(source)) { IRecordClassDescriptorInfo typedSource = ((IRecordClassDescriptorInfo)(source)); if ((typedSource.Parent != null)) { if (((this.Parent == null) || (this.Parent.GetType() == typedSource.Parent.GetType()))) { this.Parent = ((RecordClassDescriptor)(typedSource.Parent.Clone())); } else { this.Parent.CopyFrom(typedSource.Parent); } } else { this.Parent = null; } if ((typedSource.HasIsAbstract() == true)) { this.IsAbstract = typedSource.IsAbstract; } else { this.NullifyIsAbstract(); } if ((typedSource.HasIsContentClass() == true)) { this.IsContentClass = typedSource.IsContentClass; } else { this.NullifyIsContentClass(); } if ((typedSource.DataFields != null)) { this.DataFields = new List <IDataFieldInterface>(typedSource.DataFields.Count); int i; for (i = 0; (i < typedSource.DataFields.Count); i = (i + 1)) { IDataFieldInfo item = typedSource.DataFields[i]; if ((item == null)) { this.DataFields.Add(null); } else { this.DataFields.Add(((IDataFieldInterface)(item.Clone()))); } } } else { this.DataFields = null; } } return(this); }
/// <summary> /// Indicates that the engine must ignore the lines with this /// comment marker. /// </summary> /// <param name="ri">Record information</param> internal IgnoreCommentInfo(IRecordInfo ri) { mRecordInfo = ri; }
/// <summary> /// This class allows you to set some options of the records at runtime. /// With these options the library is now more flexible than ever. /// </summary> /// <param name="info">Record information</param> internal RecordOptions(IRecordInfo info) { mRecordInfo = info; mRecordConditionInfo = new RecordConditionInfo(info); mIgnoreCommentInfo = new IgnoreCommentInfo(info); }
/// <summary> /// Creates an instance DataStorage for Type /// </summary> /// <param name="recordClass">Type of the record object</param> protected DataStorage(Type recordClass) { mRecordType = recordClass; mRecordInfo = RecordInfo.Resolve(recordClass); }
/// <summary> /// Used to tell the engine which records must be included or /// excluded while reading. /// </summary> /// <param name="ri">Record information</param> internal RecordConditionInfo(IRecordInfo ri) { mRecordInfo = ri; }
/// <summary> /// This class allows you to set some options of the fixed length /// records but at runtime. /// With this options the library is more flexible than never. /// </summary> /// <param name="info">Record information</param> public FixedRecordOptions(IRecordInfo info) : base(info) { }
/// <summary> /// Deep copies content from src instance to this. /// <param name="source">Source for copy.</param> /// <returns>this.</returns> /// </summary> public new RecordClassDescriptor CopyFrom(IRecordInfo source) { return((RecordClassDescriptor)(this.CopyFromImpl(source))); }
/// <summary> /// Deep copies content from src instance to this. /// <param name="source">Source for copy.</param> /// <returns>this.</returns> /// </summary> IRecordClassDescriptorInterface IRecordClassDescriptorInterface.CopyFrom(IRecordInfo source) { return((IRecordClassDescriptorInterface)(this.CopyFromImpl(source))); }
/// <summary> /// This class allows you to set some options of the fixed length /// records but at runtime. /// With this options the library is more flexible than never. /// </summary> /// <param name="info">Record information</param> internal FixedRecordOptions(IRecordInfo info) : base(info) { }
public int IsMatchingType([In, MarshalAs(UnmanagedType.Interface)] IRecordInfo pRecordInfo) { throw new NotImplementedException(); }
internal FixedRecordOptions(IRecordInfo info) : base(info) { }
/// <summary> /// Deep copies content from src instance to this. /// <param name="source">Source for copy.</param> /// <returns>this.</returns> /// </summary> IIntegralDataTypeInterface IIntegralDataTypeInterface.CopyFrom(IRecordInfo source) { return((IIntegralDataTypeInterface)(this.CopyFromImpl(source))); }