0
我想將匿名類型的對象存儲到db4o數據庫中。例如:如何從db4o中檢索匿名類型的對象
// Store an object of anonymous type to the db
var foobar = new {Foo="Ugh", Bar="Oh!"};
using (var db = Db4oEmbedded.OpenFile("db.db40"))
{
db.Store(foobar);
}
我用下面的代碼來檢索對象:當檢索後
// Retrieve it in a separate program
using (var db = Db4oEmbedded.OpenFile("db.db40"))
{
var query=from dynamic fb in db select fb;
query.Dump();
}
然而,對象的屬性是不可訪問:轉儲給出(在Linqpad)這個:
5IEnumerable<Object> (3 items)
GenericObject
(G) <>f__AnonymousType0`2[[System.String, mscorlib], [System.String, mscorlib]], query_vrfldn
GenericObject
(G) <>f__AnonymousType0`2[[System.String, mscorlib], [System.String, mscorlib]], query_oqabew
GenericObject
(G) <>f__AnonymousType0`2[[System.String, mscorlib], [System.String, mscorlib]], query_cfvuva
db4o支持這個用例嗎?我怎樣才能從數據庫中整齊地獲取對象?