Hi all
I'm not sure where the problem lies, but I have massive problems when
I have locally edited objects, that there is no flush before those
objects are queried from database by another method.
Example
using (new SessionScope()){
Foo foo = ActiveRecordMediator<Foo>.FindFirst();
foo.Bar = 2;
Assert.AreEqual(1,ActiveRecordMediator<Foo>.Count(Expression.Eq("Bar",2)));
}
This example fails. When I read the NH docs correctly, NH should check
for changes to a foo before querying for other Foos and hence flush
automatically.
This is a contrived example. In my production code, I have currently a
lot of such calls in my repositories:
Foo[] GetFooByBar(int bar) {
SessionScope.Current.Flush();
return ActiveRecordMediator.FindAll(Expression.Eq("Bar",bar));
}
I don't like that workaround. Any comments on what I might be doing wrong here?
-Markus
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---