I have three objects that must interact: User, SupportTicketand PhoneConversation. When someone calls for help, the User must have a SupportTicket assigned to him and PhoneConversation assigned to Ticked describing the call.
User
SupportTicket
PhoneConversation
My question is: In which entity should I put the method CreatePhoneSupportTicket()that creates the new SupportTicket and PhoneConversation, connect them to each other, and finally connect the SupportTicket to the user?
CreatePhoneSupportTicket()
I assume this cannot be on the user, because it violates SRP (the user does a few more things). But the method itself does more than one, it should create both SupportTicket and PhoneConversation. Is this a situation where a service is the best solution and then sets methods for entities? Thank you for your help!
, . SupportTicket, new SupportTicket(currentUser) . , , CreateSupportTicket() new SupportTicket() . SupportTicket, , new PhoneConversation(). - factory, . , .
new SupportTicket(currentUser)
CreateSupportTicket()
new SupportTicket()
new PhoneConversation()
... ... ? , "" , , . ? , . . Entity, . , . , , . .
( ) # 19
Factory , .
, .
, , ( , , ) - , . , , , , ID . , . , . .
, , , factory?
, ? , . , -
Ticket t = user.GetOpenTicket(); t.AddCall(currentCall);
. , , Ticket.AddCall user.GetOpenTicket .
It's hard to say without deep knowledge of your domain, but it would be wise to have aSupportTicketRepository.CreatePhoneSupportTicket(aUser, aPhoneConversation)
aSupportTicketRepository.CreatePhoneSupportTicket(aUser, aPhoneConversation)
Source: https://habr.com/ru/post/1749087/More articles:LINQ to SQL Wildcards - c #Can I use the attribute to make .net impersonate another user? - .netwhat is wrong with this sql expression? - sqlHow to break git series fixes patches for sending to another project - githttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1749086/how-would-i-go-about-writing-a-conditional-statement-to-check-if-visitor-is-coming-from-a-particular-site&usg=ALkJrhiQcnRFFkwBeuyUl9QFuCc0eUNBtwhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1749088/passing-arguments-to-a-python-service&usg=ALkJrhg8zFeRoxgFvgLa_Wt_uTL_5TOliQA paragraph with normal opacity inside a gray div - cssWebservice returns java.lang.reflect.InvocationTargetException - javaHit the external url - c #JQuery SelectList parameter Changed is not updated - jqueryAll Articles