For ex: you need a Tax Calculator behaviour which will generate a Taxes value object which is a part of the Invoice Aggregate. In other cases, you might need to allow an operation. Remember the transfer money example? Wha if we have a rule that says that you can't debit the account id the amount is lower than the balance? In this scenario we're actually dealing with 2 Domain Services: one is used to calculate the AccountBalance Value Object VO the other encapsulates the "amount must be greater than the balance" rule.
In a business case we can use multiple DS and this might look like the Anaemic Domain. But it's not, the reason being that Aggregates should be as small as possible, not because someone said so, but because they should contain only the relevant behaviour for that model.
Not every related behaviour. If something is 'outside' an Aggregate, then it's probably is a Domain Service. A DS is just a name signaling business behaviour. It doesn't mean you have to implement it in one way or another. In many cases you can implement all the domain services from that Bounded Context as static functions in one class, while in other cases you might want one class per DS.
As with everything, it depends. A DS should be visible and consumed inside that Bounded Context only! Yes, you can define interfaces that can be used by your application service, they're great for testing, however their concrete implementation should be in the same BC as the business cases where it's used.
Let's say we need to calculate tax but the domain expert says they're using some website to do it and luckily for you, it provides an API and a client library.
We need that functionality, but it's implementation is not part of our Domain. This is what I call an External Service. The easiest way to use it is to define an abstraction interface part of your BC that will act as if it's a Domain Service, however its implementation will be part of the Infrastructure and it will act as a wrapper around the client library.
This is how we keep things decoupled. If later the calculation will be performed in-house, just implement a new class inside that BC and reconfigure the DI Container. Simple stuff. What if we need a service which is part of our app but part of another BC? Korean translated name. Page name. Page type.
Portuguese name. Romaji name. Spanish name. Universal Conquest Wiki. Abyss King Gilgamesh. Amnesty King Doom Makina. Deus ex machina. Chaos King Apocalypse. Cursed King Siegfried.
Destiny King Zero Laplace. Pierre-Simon Laplace. Doom King Armageddon. Super Doom King Bright Armageddon. Super Doom King Dark Armageddon. Super Doom King Purple Armageddon. Dragon King Pendragon. Dragonbane King Beowulf.
Duo-Dawn King Kali Yuga. Eulogy King Vice Requiem. Flame High King Genghis. Genghis Khan. Flame King Genghis. Gust High King Alexander.
Alexander III of Macedon. Gust King Alexander. Knowledge King Tomb Conquistador. Marksman King Tell. William Tell. Oblivion King Abyss Ragnarok. Oracle King d'Arc. Joan of Arc.
0コメント