ln.types/odb/ODBObjectReader.cs

38 lines
905 B
C#

// /**
// * File: ODB.cs
// * Author: haraldwolff
// *
// * This file and it's content is copyrighted by the Author and / or copyright holder.
// * Any use wihtout proper permission is illegal and may lead to legal actions.
// *
// *
// **/
using System;
using System.IO;
using ln.types.serialize;
namespace ln.types.odb
{
public class ODBObjectReader : ObjectReader
{
public ODB ODB { get; }
public ODBObjectReader(ODB odb, Stream stream) :
base(stream)
{
ODB = odb;
}
public override object QueryReferencedObject(object re)
{
if (re is Guid)
{
Guid persistenceID = (Guid)re;
IPersistent persistent = ODB.LoadPersistent(persistenceID);
return persistent;
}
return base.QueryReferencedObject(re);
}
}
}