asp.net mvc - How configure Nhibernate to not save object in current session -


i have 3 entites: users, roles , permissions. there 2 controllers: usercontroller , rolepermissioncontroller. controller wrapped nhibernate session.

when create fill role permissions, user doesn't exist. storage new permission object in asp.mvc session. wants save new role permission when i`ll create user in usercontroller.

but when filled new role exist permission (i got db nhibernate) , went user controller new object role created, without call session.saveorupdate or other methods.

i tried use evict after fill new role exist permissions:

microsoft.practices.servicelocation.servicelocator.current.getinstance<isession>().evict(newrole); 

but didn't help. want nhibernate - don't save entity on transaction (rolepermissioncontroller) - , save connected user object entities in usercontroller.

this doesn't answer question directly, still might solution - how collecting information through viewmodel, end single controller action takes information viewmodel, creates role , user @ same time (i.e. during same request), , no need messy session stuff.

maybe not answer looking for, i've done similar way, , works fine.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -