I have my (JSON) API structured like this (which I'm pretty happy with):
/_V1 /Controllers V1EntityController.cs // Applies to version 1 only /_V2 /Controllers V2OtherEntityController.cs // Applies to versions 2 and below /Controllers/ EntityController.cs // Applies to versions 2 and above OtherEntityController.cs // Applies to versions 3 and above
But as the project has progressed both the
OtherEntity classes has become full of legacy properties and a bunch of
ShouldSerializexxx methods. They also then also contain properties and sub-classes which are only for serialization.
Would a better solution for this be to create "Models" in the API project like so:
/_V1 /Controllers V1EntityController.cs /Models V1EntityModel.cs /_V2 /Controllers V2OtherEntityController.cs /Models V2OtherEntityModel.cs /Controllers EntityController.cs OtherEntityController.cs /Models EntityModel.cs OtherEntityModel.cs
Then convert to and from the classes in the core project? What's the industry recognised practice for handling this scenario?