VelocityDB & VelocityGraph

Object and Graph Database - ask us, share & let us know what you need.

Reference to object without opening

How can I add a reference to an object, if I know its oid, and I don't want to open it?

If I just do :

var referenceToObj = new EntityObject{ID = knownOID}
var newObj = new AnotherObject(referenceToObj);
session.Persist(newObj);

than both newObj is created and new object referenceToObj is created (and it is not desired). I think, that API ignores its ID property and looks at IsPersistent which returns false;

Lazy using BTree collection

When I use BTreeSet<T> or BTreeMap<S,T> (where S is value type, T is OptimizedPersistable), how can I get just OID instead of full object? I.e. when using 

set.Where(x=>x.Id==1).First() 

or

map[id]

Sometimes I don't need to open full non-cached object from network and disk and I just want to get its oid (an element of internal keysArray or valuesArray). Is there any way to achieve it  ? Maybe is there some extension for this collections there?

Count of the objects per page

Would be performance affected if we store millions of frequently updated objects  with objectsPerPage = 1 (to avoid page locking for server session)? The storage is not considered

ServerClientSession - caching and multithreading.

1) Where does it cache data? In memory on server side or client side? If I am using such code

var session = getCachedSession();
session.BeginRead();
var data = GetData();
session.Commit();
return data;

then next GetData() always opens objects from server disk (even with CacheEnum.Yes).

If the code just like that:

var session = getCachedSession(); //long read transaction
return GetData();

then GetData() immediately gets data from client memory. I don't want to store data in client's memory. How can I cache data only in the memory of the server till first update of related pages? What about caching of system databases (schema, locations etc)?

2) What is proper usage of ServerClientSession in multiple threads (in one process)? I see, the class itself is not thread-safe, and creation of an instance is expensive. Is there any way to make its singleton instance thread-safe (without lock(session) )? In the moment I am manually maintaining a pool of several initialized ServerClientSession using ConcurrentStack; each thread pops (creates if needed) and pushes back own instance with separate transaction block (BeginRead/Update - Commit block). Maybe is there better approach that we could use?