2 Replies - 467 Views - Last Post: 07 July 2017 - 09:56 PM

#1 Damage  Icon User is offline

  • Lord of Schwing
  • member icon

Reputation: 284
  • View blog
  • Posts: 1,961
  • Joined: 05-June 08

Datacontracts and the DRY principle

Posted 07 July 2017 - 08:14 PM

I have multiple methods within an endpoint that require the same model, which would make me think that I should be re-using the same datacontract but given that they are separate methods possessing the potential to change separately, it also makes me think that i should use separate datacontracts?
Is This A Good Question/Topic? 0
  • +

Replies To: Datacontracts and the DRY principle

#2 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 5884
  • View blog
  • Posts: 20,083
  • Joined: 05-May 12

Re: Datacontracts and the DRY principle

Posted 07 July 2017 - 09:18 PM

Sounds like a perfect place for inheritance and polymorphism.
Was This Post Helpful? 1
  • +
  • -

#3 Damage  Icon User is offline

  • Lord of Schwing
  • member icon

Reputation: 284
  • View blog
  • Posts: 1,961
  • Joined: 05-June 08

Re: Datacontracts and the DRY principle

Posted 07 July 2017 - 09:56 PM

ahhh, pages read once and then forgotten. Thanks Skydiver!

For anyone like me that's either completely forgotten or never implemented polymorphism here's an example
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1