Design pattern for handling multiple message types

前端 未结 10 1042
甜味超标
甜味超标 2020-11-28 03:13

I\'ve got the GOF sitting on my desk here and I know there must be some kind of design pattern that solves the problem I\'m having, but man I can\'t figure it out.

F

10条回答
  •  無奈伤痛
    2020-11-28 03:54

    I know this is an older thread, with several very good answers over the years.

    However, in 2018, I'd use a package such as Jimmy Bogard's MediatR (https://github.com/jbogard/MediatR).

    It provides decoupling of message sending and processing with patterns such as request/response, Command/Query, One-way, Pub/Sub, async, polymorphic dispatching, etc.

提交回复
热议问题