❔ Is Repository Pattern still recommended with Microservices and EF Core ?
Hi friends,
Oh $hit, here we go again, with this funny and forever debate.
When we have Microservices architecture project, where each service has its own database and uses
EF Core
as an O/RM
in addition they uses RabbitMQ
as a Message broker
.
The following are some questions need your experience share:
Is using Repository Pattern
a recommended part in this case , even if the EF Core
making the Abstraction
between database and App ?
If the first one is not recommended, is the CQRS
pattern recommended for this case ?
Please do not hesitate to share your experiences with me, and massive thanks in advance.12 Replies
No and No
That's just my opinion
which one no
Repository
or CQRS
or both?What kind of repository?
A generic one?
@MBARK
lets say both using
Generic repository
for the most repeated routines, and (Specific repository
) adding custom methods if needed for custom operatons ( it depends on entities )Well the db context is already a generic repository (and unit of work)
Great
So, repository pattern can be used to perform some custom operations that
DbContext
can't ?A custom repository would used to add value on top of the db context
Like input verification that the db can't (or shouldn't) handle
Also, if I use the
CQRS
in each service, is this good ?I haven't used CQRS, so I can't speak to that
@jcotton42 I have an out of thread question but related to the topic, lets say a
Service A
want to get data from Serrvice B
is the best practice to cunsume the API
of B
from A
or using RabbitMQ
??¯\_(ツ)_/¯
I'd ask that in a place like #architecture
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.