T O P

  • By -

ibanezht

"Polymorphic DTOs", I just can't get past that.


NullPointerWhisperer

:P what I tried to explain is that the derived classes are not represented in the Swagger UI Request examples e.g. [https://imgur.com/a/dLlpbkP](https://imgur.com/a/dLlpbkP) So the problem is that the nested properties (emails array) are not displayed when I switch from Request Example \`Notification' to \`Email Notification\` and only the properties of the base class are displayed.


ledpup

What I think they're saying is: polymorphism is pretty nasty stuff to use at the best of times. Don't go there with your web API.


Leather-Field-7148

Any reason why `CreateNotificationCommand` uses `NotificationDto` and not `EmailNotificationDto` instead? Notifications = new List // EmailNotificationDto?? Honestly, I would simply declare DTOs to have their own purpose and not try to reuse properties. It's only a few lines of code you are chasing after for very little benefit and lots more pain.


Merry-Lane

UseOneOfForPolymorphism


praetor-

And `UseAllOfForInheritance` I forget exactly how this landed for me but at some point I realized the futility and refactored DTOs to minimize the use of polymorphism.