public void Write(ChildrenList_CreateOnlyChildRaw childrenList_CreateOnlyChildRaw) { if (childrenList_CreateOnlyChildRaw.Key != nextKey) { throw new Exception($"ChildrenList_CreateOnlyChildRaw's key {childrenList_CreateOnlyChildRaw.Key} should be {nextKey}."); } nextKey++; csvWriter.StartNewLine(); csvWriter.Write(childrenList_CreateOnlyChildRaw.Text); if (childrenList_CreateOnlyChildRaw.CreateOnlyParentKey < 0) { throw new Exception($"Cannot write childrenList_CreateOnlyChild to CSV File, because CreateOnlyParent is not stored in DC.Data.ChildrenList_CreateOnlyParents."); } csvWriter.Write(childrenList_CreateOnlyChildRaw.CreateOnlyParentKey.ToString()); if (childrenList_CreateOnlyChildRaw.CreateOnlyParentReadonlyKey < 0) { throw new Exception($"Cannot write childrenList_CreateOnlyChild to CSV File, because CreateOnlyParentReadonly is not stored in DC.Data.ChildrenList_CreateOnlyParentReadonlys."); } csvWriter.Write(childrenList_CreateOnlyChildRaw.CreateOnlyParentReadonlyKey.ToString()); if (childrenList_CreateOnlyChildRaw.CreateOnlyParentNullableKey is null) { csvWriter.WriteNull(); } else { if (childrenList_CreateOnlyChildRaw.CreateOnlyParentNullableKey < 0) { throw new Exception($"Cannot write childrenList_CreateOnlyChild to CSV File, because CreateOnlyParentNullable is not stored in DC.Data.ChildrenList_CreateOnlyParentNullables."); } csvWriter.Write(childrenList_CreateOnlyChildRaw.CreateOnlyParentNullableKey.ToString()); } if (childrenList_CreateOnlyChildRaw.CreateOnlyParentNullableReadonlyKey is null) { csvWriter.WriteNull(); } else { if (childrenList_CreateOnlyChildRaw.CreateOnlyParentNullableReadonlyKey < 0) { throw new Exception($"Cannot write childrenList_CreateOnlyChild to CSV File, because CreateOnlyParentNullableReadonly is not stored in DC.Data.ChildrenList_CreateOnlyParentNullableReadonlys."); } csvWriter.Write(childrenList_CreateOnlyChildRaw.CreateOnlyParentNullableReadonlyKey.ToString()); } csvWriter.WriteEndOfLine(); }
public bool ReadLine([NotNullWhen(true)] out ChildrenList_CreateOnlyChildRaw?childrenList_CreateOnlyChildRaw) { if (csvReader.IsEndOfFileReached()) { csvReader.Dispose(); childrenList_CreateOnlyChildRaw = null; return(false); } childrenList_CreateOnlyChildRaw = new ChildrenList_CreateOnlyChildRaw(); childrenList_CreateOnlyChildRaw.Key = nextKey++; childrenList_CreateOnlyChildRaw.Text = csvReader.ReadString(); childrenList_CreateOnlyChildRaw.CreateOnlyParentKey = csvReader.ReadInt(); childrenList_CreateOnlyChildRaw.CreateOnlyParentReadonlyKey = csvReader.ReadInt(); childrenList_CreateOnlyChildRaw.CreateOnlyParentNullableKey = csvReader.ReadIntNull(); childrenList_CreateOnlyChildRaw.CreateOnlyParentNullableReadonlyKey = csvReader.ReadIntNull(); csvReader.ReadEndOfLine(); return(true); }