public void WriteObjectRow(BulkObject bulkObject, bool excludeReadonlyData) { var values = new RowValues(); bulkObject.WriteToRowValues(values, excludeReadonlyData); values[StringTable.Type] = _bulkObjectFactory.GetBulkRowType(bulkObject); _streamWriter.WriteLine(_formatter.FormatCsvRow(values.Columns)); }
/// <summary> /// Reads the object only if it matches a predicate /// </summary> /// <typeparam name="T">Type of the object</typeparam> /// <param name="predicate">Predicate that needs to be matched</param> /// <param name="result">The next object from the file if the object matches the predicate, null otherwise</param> /// <returns>True is object matches the predicate, false otherwise</returns> public bool TryRead <T>(Predicate <T> predicate, out T result) where T : BulkObject { var peeked = Peek(); var instanceOfT = peeked as T; if (instanceOfT != null && predicate(instanceOfT)) { _nextObject = null; instanceOfT.ReadRelatedDataFromStream(this); result = instanceOfT; return(true); } result = null; return(false); }
public void WriteObjectRow(BulkObject bulkObject) { WriteObjectRow(bulkObject, false); }
public string GetBulkRowType(BulkObject bulkObject) { return(TypeReverseMap[bulkObject.GetType()]); }