REST Service and CQRS

Posted by Paul Wade on Programmers See other posts from Programmers or by Paul Wade
Published on 2014-06-03T14:17:42Z Indexed on 2014/06/03 15:52 UTC
Read the original article Hit count: 308

Filed under:
|
|
|

I am struggling with architecture on a new project. I am using the following patterns/technology.

  • CQRS - anything going in goes through a command
  • REST - using WebAPI
  • MVC - asp.net mvc
  • Angular - building a spa
  • nhibernate

I belive this provides some great separation and should help keep a very complex domain from growing into a giant set of services that mix queries with other business logic.

  • The REST services have become non restful. They are putting methods in rest that are "SearchByDate", "SearchByItem" etc.
  • Service Methods that execute commands are called with a "web" model class, a new command is built in the service and executed, I feel like there is a lot of extra code.

I expected this to be much different but I wasn't around to keep things on track.

Finally my questions are this...

I would have liked to see PUT Person (CreatePersonCommand) but then I realized that isn't restful either is it? the put should be a person entity not a command.

Can I make CQRS and REST service work together or am I going about this all wrong?

How do I handle service methods that don't fit into a REST model. I am not performing CRUD on the object but rather executing some business logic. I.E. I don't want the UI to be responsible for how a shipment is "unshipped" I want the service layer to worry about that.

© Programmers or respective owner

Related posts about web-services

Related posts about rest