Quantcast
Channel: User Álvaro García - Software Engineering Stack Exchange
Viewing all articles
Browse latest Browse all 41

How to get the information from another root entity to validate some operation?

$
0
0

I am trying to put in practice a small DDD example but I have some dubts.

In my example, I have an Order and a Status.

The Order can be this:

Order{    long Id;    long IdStatus;    long IdBuyer;    Address Address;}Status{    long Id;    string Status;    bool IsFirstState;    bool AllowModifications;    bool CanBeAccepted;    //another bool properties to can check if an action can be done.}

I am not sure if it is a good idea that the state it is a root entity, but I would like to can edit for example if the status property is wrong (perhaps is write wrong). So I need to can identify by ID.

Also I have properties to can know if an action can be done or not. For example, Send(), if the actual status doesn't allow to send, then don't do it.

I decide in this way because I can add new status in the database without needed of change the code. If I would have hardcode a fix number of states, if I need a new one, it would be harder to added new status.

Well, so really I have two questions here:

1.- The general doubt, how could access to the data of the status (or data of another root entity) from another if it is needed for the logic.

2.- If it is a good idea to stablish the status of the order as root entity.

Thanks.


Viewing all articles
Browse latest Browse all 41

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>