WIP
parent
da04a75a1a
commit
c813829b51
|
@ -116,6 +116,9 @@
|
|||
<Compile Include="test\CacheTests.cs" />
|
||||
<Compile Include="test\ODBTests.cs" />
|
||||
<Compile Include="test\TypesTests.cs" />
|
||||
<Compile Include="odb\ng\diff\Diff.cs" />
|
||||
<Compile Include="odb\ng\diff\DocumentDiff.cs" />
|
||||
<Compile Include="odb\ng\diff\ListDiff.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="odb\" />
|
||||
|
|
|
@ -5,9 +5,9 @@ namespace ln.types.odb.ng.diff
|
|||
public abstract class Diff
|
||||
{
|
||||
|
||||
public abstract ODBValue Apply(ODBValue src);
|
||||
public abstract ODBEntity Apply(ODBEntity src);
|
||||
|
||||
public static Diff Construct(ODBValue src,ODBValue dst)
|
||||
public static Diff Construct(ODBEntity src,ODBEntity dst)
|
||||
{
|
||||
if (!src.GetType().Equals(dst.GetType()))
|
||||
{
|
||||
|
@ -27,14 +27,14 @@ namespace ln.types.odb.ng.diff
|
|||
|
||||
class SimpleDiff : Diff
|
||||
{
|
||||
public ODBValue DestinationValue { get; }
|
||||
public ODBEntity DestinationValue { get; }
|
||||
|
||||
public SimpleDiff(ODBValue dst)
|
||||
public SimpleDiff(ODBEntity dst)
|
||||
{
|
||||
DestinationValue = dst.Clone();
|
||||
DestinationValue = dst;
|
||||
}
|
||||
|
||||
public override ODBValue Apply(ODBValue src)
|
||||
public override ODBEntity Apply(ODBEntity src)
|
||||
{
|
||||
return DestinationValue;
|
||||
}
|
||||
|
|
|
@ -6,22 +6,22 @@ namespace ln.types.odb.ng.diff
|
|||
{
|
||||
public class DocumentDiff : Diff
|
||||
{
|
||||
Dictionary<ODBValue, Diff> propertyDiffs = new Dictionary<ODBValue, Diff>();
|
||||
Dictionary<ODBEntity, Diff> propertyDiffs = new Dictionary<ODBEntity, Diff>();
|
||||
|
||||
public DocumentDiff(Document src, Document dst)
|
||||
{
|
||||
HashSet<ODBValue> keys = new HashSet<ODBValue>(src.Keys);
|
||||
foreach (ODBValue key in dst.Keys)
|
||||
HashSet<ODBEntity> keys = new HashSet<ODBEntity>(src.Keys);
|
||||
foreach (ODBEntity key in dst.Keys)
|
||||
keys.Add(key);
|
||||
|
||||
foreach (ODBValue key in keys)
|
||||
foreach (ODBEntity key in keys)
|
||||
{
|
||||
if (!src[key].Equals(dst[key]))
|
||||
propertyDiffs.Add(key, Diff.Construct(src[key], dst[key]));
|
||||
}
|
||||
}
|
||||
|
||||
public override ODBValue Apply(ODBValue src)
|
||||
public override ODBEntity Apply(ODBEntity src)
|
||||
{
|
||||
Document srcDocument = src as Document;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace ln.types.odb.ng.diff
|
|||
|
||||
}
|
||||
|
||||
public override ODBValue Apply(ODBValue src)
|
||||
public override ODBEntity Apply(ODBEntity src)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ using ln.types.odb.values;
|
|||
using System.Linq;
|
||||
using ln.types.odb.ng.storage.bases;
|
||||
using ln.types.threads;
|
||||
using ln.types.odb.ng.diff;
|
||||
namespace ln.types.odb.ng.storage.session
|
||||
{
|
||||
class SessionStorage : ChainedStorage
|
||||
|
@ -118,14 +119,12 @@ namespace ln.types.odb.ng.storage.session
|
|||
if (!GetStorageTimestamp(document.ID).Equals(document.StorageTimeStamp))
|
||||
{
|
||||
Document cacheDocument = cachedDocument.CachedCopy;
|
||||
|
||||
Document storageDocument = Storage.Load(document.ID);
|
||||
|
||||
DocumentChanges storageChanges = new DocumentChanges(cacheDocument, storageDocument);
|
||||
DocumentChanges sessionChanges = new DocumentChanges(cacheDocument, document);
|
||||
|
||||
Document prepare = cacheDocument.Clone() as Document;
|
||||
DocumentDiff cacheDiff = new DocumentDiff(cacheDocument, document);
|
||||
DocumentDiff storageDiff = new DocumentDiff(cacheDocument, storageDocument);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue