Add some nifty DataPacket/TableUpdate IObservable utils
This commit is contained in:
1 parent
6b0030559b
commit
7e79a21cd4
12 files changed
+521
-2
No files matched your search
@@ -3,6 +3,8 @@ using System.Collections;
|
||||
using System.Data;
|
||||
using BCG.Utilities.General;
|
||||
|
||||
using Bts.DataStreamCore;
|
||||
|
||||
namespace BCG
|
||||
{
|
||||
[Serializable]
|
||||
@@ -183,6 +185,7 @@ namespace BCG
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
IBlueTableSchema IDataPacket.Schema => schema;
|
||||
|
||||
/*
|
||||
status D total A total D this A This D' total A' Total
|
||||
@@ -314,6 +317,24 @@ namespace BCG
|
||||
}
|
||||
}
|
||||
|
||||
public class DataPacket<T> : IDataPacket<T> where T : IBlueRow {
|
||||
public DataPacket(IBlueRowCollection<T> newRows, IBlueRowCollection<T> addedRows, IBlueRowCollection<T> deletedRows) {
|
||||
this.newRows = newRows;
|
||||
this.addedRows = addedRows;
|
||||
this.deletedRows = deletedRows;
|
||||
}
|
||||
|
||||
public IBlueRowCollection<T> newRows { get; }
|
||||
public IBlueRowCollection<T> addedRows { get; }
|
||||
public IBlueRowCollection<T> deletedRows { get; }
|
||||
|
||||
public static DataPacket<T> Empty(IBlueTableSchema schema) =>
|
||||
new(
|
||||
new BlueTableImmutable<T>(schema),
|
||||
new BlueTableImmutable<T>(schema),
|
||||
new BlueTableImmutable<T>(schema));
|
||||
}
|
||||
|
||||
public static class DataPacketExtensions {
|
||||
public static bool HasChanges(this DataPacket dataPacket) =>
|
||||
dataPacket.addedRows.Count > 0 || dataPacket.deletedRows.Count > 0;
|
||||
|
||||
Reference in new issue
Block a user