There were no schemas, mapping layers, sql queries or setup scripts to fiddle with.
The only problem I seemed to encounter was that of binding my object collections to drop down lists that were expecting an id for each bound object. Db4objects does not have great support for generating sequences numbers for objects being persisted.
There is an internal representation of the object id, but this requires groping into the guts of the api to retrieve it. Perhaps what's required is some interfaces e.g. ISequenceGenerator which can be implemented by entity objects requiring an id. Value objects by their very definition would not need to implement this interface.
private void AddItem(T entityToStore) where T:IEntity
{
using(IObjectContainer db = Db4oFactory.OpenFile(Db4oService.FilePath))
{
db.Set(entityToStore);
}
}
The sheer ease with which I was able to integrate Db4Objects left me a bit uneasy. Can object persistence be so easy? Why are object databases not prevalent?
No comments:
Post a Comment