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.

nservicebus - Impossible to have two sagas that handle the same message type -


i have 2 different sagas (i mean saga types) handle same message.

     public class attachmessagetobugsaga : tpsaga<attachmessagetobugsagadata>, iamstartedbymessages<messageisnotattached>, ihandlemessages<messageattachedtogeneralmessage>     {         public override void configurehowtofindsaga()         {             configuremapping<messageattachedtogeneralmessage>(              saga => saga.id,              message => message.sagaid              );         }         public void handle(messageisnotattachedtobug message)         {             send(new attachmessagetogeneralcommand { messageid = 66, generalid = 13 });         }          public void handle(messageattachedtogeneralmessage message)         {             //do stuf fhere         }     }      public class attachmessagetobugsagadata : icontainsagadata     {         public guid id { get; set; }         public string originator { get; set; }         public string originalmessageid { get; set; }     }      public class attachmessagetorequestsaga : tpsaga<attachmessagetorequestsagadata>, iamstartedbymessages<messageisnotattachedtorequest>, ihandlemessages<messageattachedtogeneralmessage>     {         public override void configurehowtofindsaga()         {             configuremapping<messageattachedtogeneralmessage>(              saga => saga.id,              message => message.sagaid              );         }          public void handle(messageisnotattachedmessagetorequest message)         {             //do stuff here         }          public void handle(messageattachedtogeneralmessage message)         {             //do stuff here         }     }      public class attachmessagetorequestsagadata : icontainsagadata     {         public guid id { get; set; }         public string originator { get; set; }         public string originalmessageid { get; set; }     } 

when run sample exception :

system.invalidcastexception: unable cast object of type 'mycustomplugin.attachmessagetogeneralsagadata' type 'mycustomplugin.attachmessagetorequestsagadata'.

i understand why happens, still need workaround. tried implement own ifindsagas class :

public class sagafinder : ifindsagas<attachmessagetogeneralsagadata>.using<messageattachedtogeneralmessage>, ifindsagas<attachmessagetorequestsagadata>.using<messageattachedtogeneralmessage>, ifindsagas<attachmessagetorequestsagadata>.using<messageisnotattachedtorequest>, ifindsagas<attachmessagetorequestsagadata>.using<messageisnotattachedtobug> {     attachmessagetogeneralsagadata ifindsagas<attachmessagetogeneralsagadata>.using<messageattachedtogeneralmessage>.findby(messageattachedtogeneralmessage message)     {         return objectfactory.getinstance<attachmessagetogeneralsagadata>();     }      attachmessagetorequestsagadata ifindsagas<attachmessagetorequestsagadata>.using<messageattachedtogeneralmessage>.findby(messageattachedtogeneralmessage message)     {         return objectfactory.getinstance<attachmessagetorequestsagadata>();     }      public attachmessagetorequestsagadata findby(messageisnotattachedtorequest message)     {         return new attachmessagetorequestsagadata();     }      public attachmessagetorequestsagadata findby(messageisnotattachedtobug message)     {         return new attachmessagetorequestsagadata();     } } 

but not finders "messageattachedtogeneralmessage". please tell me if there other workaround, or how make example working.

i'm not sure having more 1 saga within same process boundary works - @ least, i've had problems too. it's better (in general) have sagas separated 2 different processes anyway, because otherwise cause lot of locking , potentially deadlocks on saga storage.

is message handled 2 sagas sent or published? if it's published (or can made to), easy separate sagas 2 separate assemblies. sure manually call bus.subscribe() message type in each saga, since sagas don't auto-subscribe messages listed in app.config.

if message sent, , there's nothing can change it, create central handler existing message type either publishes second message type go both sagas, or sends 2 separate messages each saga.


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 -