i am using db4o 8 with c# 3.5, The TA and TP is enabled on all of my domain model cla开发者_JAVA技巧sses. the problem is i have my own ID Generator attached to creating event with following code:
IEventRegistry eventRegistry = EventRegistryFactory.ForObjectContainer(Container); eventRegistry.Creating += new EventHandler(eventRegistry_Creating);
i have a USER class containing a list of ORDER. problem is if i update the USER class, creating event does not fire for new added ORDER objects in USER.ORDERS.
before version 8 i used v7.4 and it worked fine, but today i upgraded it to v8 to gain some performance benefits but this problem occurred.
would you please help me to fix this problem ?
I tried to reproduce the issue and it worked for me fine. Are you sure that the added order is actually stored? What kind of collection are you using? The db4o activatable collections or the regular CLR collections? And which version did you use?
Here my little test-case which worked:
var eventRegistry = EventRegistryFactory.ForObjectContainer(container);
var expectFireCreated = false;
eventRegistry.Created += (sender, args) =>
{
expectFireCreated = true;
};
var costumer = (from Constumer c in container
select c).First();
costumer.Orders.Add(new Order("55"));
container.Commit();
Assert.IsTrue(expectFireCreated);
精彩评论