Closed PandaWood closed 9 years ago
Oh bugger, I didn't do like this
var lifestyle = new PerWebRequestLifestyleModule(); lifestyle.Init();
Which seems very likely to be my problem.
Though I did already have this setup in my web config for use in Windsor, in general.
<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
Is it possible that this web.config registration doesn't cut it for NHibernateFacility?
No, sorry. Adding the PerWebRequestLifestyleModule, explicitly in code, didn't fix the problem that when I call Session.Delete(obj), within a controller method, nothing happens. No transaction is committed.
If I call container.ResolveScope
BTW I never got this to work over several days of effort. Then later my experienced colleague tried and failed after several days of effort as well. We were already using the previous version of NHibernateIntegration without issues - which makes this so much more perplexing. But we were never able to upgrade to this - as far as we are concerned, it just doesn't work, Sorry.
Hi,
SessionPerWebRequest doesn't seem to be generating any transactions. While calling Session.Save() generally ends up persisting something, calls to Delete() and updating objects fail to do anything. No errors. No deleting. Nothing.
My setup/config is almost identical to that in the per_web_request_soec,cs in the code base (as below)
However, I've just found basic read/writes fail to commit.
When I call my injected sessionManager.OpenSession().Delete(obj) on a correct and valid object, it fails to delete the record. No DB command is issued.
If I change to the code to call a Session.CreateQuery("delete bla where bla") it works! So the setup is basically right, it's as if the SessionPerWebRequest just isn't working properly.
Any config that's not mentioned anywhere in the wiki that I could have missed?