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.

c# - Retry a service call ONLY ONCE in the event service fails logic help -


so have function calls web service return int indicitating success or various types of failures may have occurred. after recieve result service, run through switch statement , procceed accordingly based on encountered during service execution.

private void example() {  int result = executewebservice();  switch(result) { case 0: //no errors noerrorslogic(); break; case 1: // manual retry  manualretrylogic(); break; case 2: //  validation error validationerrorlogic(); break; default: // run time error occurred logicoptiond(); // @ point want to call service again once see if succeed break; }  } 

generally, i'd add call function calls sevice , runs through results on again, don't want continuously run until service succeeds. in default option want force 'retry' calling service once - , process results accordingly.

any ideas?

you can alwaus do:

private void example(bool retry = true) {   .... default:  if(retry) {   example(false); } break; } 

just add parameter , have function call if fails. pass in false value parameter tells function if fails again, don't anything.

in c# 4.0 example(bool retry = true) can set default value, don't have worry existing code not having true value set. in 3.5 or below create overloaded method on parameter , 1 without. 1 without calls 1 so:

example() {    example(true); } 

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 -