Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

.net - Session-in-view and TransactionScope -


we have asp.net webforms app using nhibernate. here specifics:

  • we need distributed transactions because write database queue.
  • because web app, use recomended session-in-view pattern. have httpmodule opens nhibernate session on beginrequest event , closes on endrequest.
  • within flow of request, have several separate moments need transactional work. this, use transactionscope.

so basically, happens (pseudocode):

using(var session = sessionfactory.createsession()){   using(var tx1 = new transactionscope(){     //work work work     tx1.complete();   }    //other work    using(var tx2 = new transactionscope(){     //work work work     tx2.complete();   } } 

however situation see lot of crashes related connection database. researching gave 2 suggestions:

  • use nhibernate transaction within transactionscope
  • create session within transactionscope

however, have 2 questions these suggestions:

  1. doesn't nhibernate automatically enlist transactionscope. why need create transaction explicitly nhibernate?
  2. if must create our session within transactionscope, how can combine session-in-view pattern?

  • you must use nh transactions (session.begintransaction())
  • nh transactions automatically enlist in transactionscope
  • you don't have create session inside transactionscope.

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -