Is CQRS alternative to CRUD?
Asked Answered
B

2

6

What is different between CQRS and CRUD and can I use the UnitOfWork and Repository patterns in both cases ?

If I have a complicated relationship between the entites which one you are recommending me and why ?

CQRS pattern : http://martinfowler.com/bliki/CQRS.html
CRUD : http://en.wikipedia.org/wiki/Create,_read,_update_and_delete

Any help will be greatly appreciated.

Booze answered 5/9, 2013 at 9:19 Comment(1)
CRUD and CQRS are completely different things that aren't mutually exclusive. CQRS only means that your write model is separated from your read model. Therefore, both can scale independently of each other. While CQRS is often associated with DDD & EventSourcing these aren't prerequisites of CQRS.Interbedded
D
6

CQRS is usually used for complex application projects. DDD is also used for complex application projects and seems to be associated with CQRS. DDD attempts to deal with the complexity of the behaviour. CRUD systems have little or no behaviour. A system with little or no behaviour doesn't really have a complex event structure, so it's hard to say how much benefit you get from CQRS.

Doering answered 5/9, 2013 at 9:27 Comment(0)
T
4

CRUD - you perform reading and writing operations on one object.

CQRS - you split reading and writing operations into two separate objects. You can simplify it, and implement it as two separate interfaces on one object: one for reading, and one for writing. Then you can instantiate objects depending on what do you need it for. Or you can move it even further, and use separate databases for reading and writing.

For most cases CRUD is the answer, but CQRS can be applicable in some complex scenarios.

If you are using Entity Framework, you shouldn't use Unit of Work and Repository, because it's natively implemented by EF.

In CRUD, using Unit of Work and Repository is normal. For CQRS - I have no knowledge.

Therapeutics answered 28/10, 2016 at 10:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.