java - Domain model that needs to store another domain model -


Suppose I have the following simple domain model setup:

  class events. .} Class Schedule Event {event event; Date time date; ..}   

And I want to see the events as detailed as possible, I will call it

  class event {public zero plan (Date time date) {// Can I create and store a planned event here? // Use a repository in other words}   

I combine the planning method, because from within the omnipresent language, you plan an event that happens in a planned event in the future. . Therefore it seems natural to put the method of planning in the event class.

I have always read that you should not use repostories in domain objects, I can understand why, but how do I solve the above version?

Does such domain events occur in the game?

  class event {public zero plan (date time date) {DomainEventPublisher .instance (). Publish (New planned art-crafted (this, date))); }   

Where will the domain event ensure that any planned event will be created and stored (by a repository)?

Is it imaginable that both events and planned gutts are the total roots? I suspect that the incident should know something about planned events, certainly not to build one - it is beyond its scope, tells Evans about factories:

When an object is formed, or the whole aggregate becomes complicated or reveals too much internal structure, the factors provide encapsulation.

Perhaps you use an entire factory to create a planned brick for an event, to minimize two, I'm not going through a schematic event rather than a direct object reference I like to refer to the event through some unique event-id. You can use this ID to view the event through its repository.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -