nhibernate event supervision windows use applications
i'm building concentration runs windows service. there components consolidate few wcf services, fan gui - nonetheless windows use opening database.
so, concentration long-running server, i'd provoke the opening scalability, i looking provoke information opening among things. i posted another thread second-level caching.
this post event supervision long-running thread accesses database.
should i controlling thread-static context?
if so, there any instance implemented.
every around net controlling nhibernate seem heavily focussed web-application impression architectures. there seems good miss support / contention non-web app designs.
at moment, enlarged controlling thread does this:
- call 3 4 dao methods
- verify state removed objects returned.
- update state needed.
- call integrate dao methods insist updated instances. (pass id vigilant instance itself - dao collect vigilant db again, set updated values session.saveorupdate() before committing transaction.
- sleep 'n' seconds
- repeat over again!
so, following common settlement any dao methods:
- open event controlling sessionfactory.opensession()
- begin transaction
- do db work. collect / transform etc
- commit trans
- (rollback box exceptions)
- finally always dispose transaction session.close()
this happens every slight dao class.
i think arrange an anti-pattern proceed doing it.
however, i'm means adequate instruction anywhere provoke it.
pls note, while thread controlling background, doing the stuff, there requests opening wcf clients any 2-3 dao calls themselves - infrequently querying/updating same objects enlarged controlling thread deals with.
any ideas / suggestions / pointers provoke the settlement severely appreciated.
if good contention going, village wiki, possbily couple here
krishna
Comments
Post a Comment