domain driven design - How to handle two or more domainevents in c#? -


in c# have scenario in @ least 2 places different domain events raised , want single hander handle them same code (other listeners may perform event specific code). handlers using following pattern;

public class somehandler : ihandler<someevent> {    public somehandler()    {       //whatever init code    }     public void handle(someargs args)    {        //common code    } } 

so best way handle more 1 event same handler? thanks

ihandler<someevent> interface perhaps can implement multiple ones:

public class somehandler : ihandler<someevent>, ihandler<someotherevent> {    public somehandler()    {       //whatever init code    }     public void handle(someargs args)    {        //common code    }     public void handle(someotherargs args)    {        //common code    } } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -