domain driven design - How can I create this component from root in DDD? -


I have a question about using the DDD to solve the following scenarios.

I have 2 entities person and email one person can have a zero or more email address (SAS) .

person is a group of a email which is a component.

  class person {set < Email & gt; Email = New Hashet & lt; Email & gt; } Class Email {String Value; Email (string value) {}}  

I have 2 requirements in the system:

  1. Users can send request to add a new email

  2. The user can temporarily make a list of emails and add them to the person.

What does 3 methods mean in DDD? Or is there a better way to meet my needs.

  1. To create a party by email, but do not add it to the email list (see createEmail ()) below

  2. < Li>

    Being a separate method for adding email to the list (see setEmail () below).

  3. To create an email for an individual and add it to the email list (see addEmail () below).


  The person in the public category {Set < Email & gt; Email = New Hashet & lt; Email & gt; Public Zero addEmail (String Value) {Email Email = Create Email (Value); Emails.add (email); } Create a public email e-mail (string value) {return new email (value); } Public Zero Set Email (Email Email) {emailss.add (email); }}  

Personally, I will see it separately:

I see only 'person' as an institution. Email is a type of value and is not a unit, because it has no identity.

Then, I will highlight the person's e-mail address as a read-only collection of the person unit. Public Zero AddEmail (Email Mail) {} Public Zero AddEmail (String Mail Address) {} Public Zero RemoveEmail (Email Mail) {} Public Zero RemoveEmail (String Mail Address) {} Email [] GetEmailAdresses () {}; } Public Structure Email {Public Email (String Address) {} Public String Address {get {return _address; }}}


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -