jeudi 26 juillet 2018

Interfaces or inheritance for DTO

I am designing a large set of DTOs in c# 7. Net 5. I want some of the DTOs to always have certain properties. For example, PersonDTO and LocationDTO should always have Id and Name properties.

Interface on DTOs seems odd and sometimes, abstract class on DTO seems wrong.

What is the best practice to impose constraints on my DTOs to ensure the DTOs have certain properties? Is base class with abstract properties better or an interface?

Aucun commentaire:

Enregistrer un commentaire