Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
5

The refresh token is solely defined by its values. And there is no continuity of the object when the values change, because it would be replaced by a new token. This is why it is a value object. This does not prevent that one of the value refers to a given user-id, which gives the impression of continuity between successive values. But it is not ...


3

With a DDD approach you are trying to match your Entities with the 'Domain Language'. I find it hard to believe that the business says "A User creates a new security token". If they do then sure, the User object should have that method and the required logic for doing the job. But I think it would be more usual for the Business to say "The User logs in" ...


3

Think of it this way, which one represents something meaningful in your domain? Something that somebody familiar with the domain (but not necessarily the technology) would understand. I.e. which one is more likely to be part of the Ubiquitous Language? Option #1: setSecurityToken()? Seems technical, it's a setter. Option #2: createNewSecurityToken()? Seems ...


3

DDD (the Blue Book) doesn't explicitly mention project structure or a packaging hierarchy as far as I can remember. It does however make the case for using the Ubiquitous Language in our code. It makes sense to translate that to packages too. So instead of basing your packaging on technical terms (like in your example), you could package your application ...


2

Conflicts: without implementing another layer of repository which returns Aggregate we cannot even >partly resolve the abovementioned pitfalls by implementing an extra layer of repository we are ignoring the built-in features of EF (every DbSet is already a repo) and over-complicating the app I have used an approach where every Aggregate gets ...


2

1) Separate models only i.e. a domain model and a read model. I think you mean command model and query model. This is typical of CQRS: 2) separate models and repositories. Typically goes by the name microservices. 3) Separate models; repositories and physical database. Separating the DBs is an implementation choice. It has no logical impact. It simply ...


1

Can Aggregate shared between services? The short answer is: no. To ensure consistency, you normally want only a single authoritative representation of an aggregate. That will normally mean that the aggregate is "stored" in one place - for example, in "the database". So in a way, sharing the authority for an aggregate is analogous to sharing a database ...


1

I just would like to understand the difference between data (which is referred to as payload) and metadata. HTTP messages, with its separation of headers from the message body, might be a useful analogy to think about. So the question is is information about the user that created/updated the item should go to Event's data or metadata? In many cases, ...


1

The simplest way to think about metadata is that it is data that describes other data. For example, the size of the payload (in bytes) is not the content of the payload but rather a data element that is about the payload. If the payload were formatted slightly differently (e.g. extra meaningless white-space), the size might change but the content/meaning ...


1

Your use case entirely depends on the demands from your business analytics. If an invoice without a single line makes no sense and must not exist, creating an empty invoice should not be possible within your code either and creating an invoice should always require a line (or lines). If an invoice might be created without specifying lines and the lines ...


1

You could remove validation from the constructor, make the constructor internal, and call it from the repository to allow unvalidated object creation. If the repository is in a separate assembly, use https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.internalsvisibletoattribute?view=netframework-4.8 Next add a public static factory ...


1

I would take a look at one of Microsoft's newer projects code named "Ambrosia" (link will take you to their Github page where the project is being developed open source) which focuses on providing a solution to this exact problem and several other major data consistency problems when developing distributed services. The cliff-notes version is that they ...


1

But I think I am doing it wrong You've got good instincts. There's a lack of clarity in the thinking around this scenario and everything will be easier if we can clean that up. I have an aggregate root called SizeRangeAggregate which holds the range of size of clothing piece dimension and price for that range. Okay, so I'm imagining your class is ...


Only top voted, non community-wiki answers of a minimum length are eligible