开发者

db4o creating event not fire on db4o 8

开发者 https://www.devze.com 2023-03-08 21:20 出处:网络
i am using db4o 8 with c# 3.5, The TA and TP is enabled on all of my domain model cla开发者_JAVA技巧sses.

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消