Complex return types #5

Closed
opened 2020-09-22 10:18:33 +00:00 by jackhadrill · 0 comments
Owner

We should use Data Transfer Objects to increase separation of concerns between database implementation and API implementation.

I haven't tried this, but something similar to the following returned by the Repository interfaces would be ideal.

namespace VCinemaApi.Dtos
{
    public class WatcherDto
    {
        public int WatcherId { get; set; }
        public string Name { get; set; }
        
        public static WatcherDto ToWatcherIdAndName(Watcher watcher)
        {
            return new WatcherDto
            {
                WatcherId = watcher.WatcherId,
                Name = watcher.Name
            };
        }
    }
}
We should use Data Transfer Objects to increase separation of concerns between database implementation and API implementation. I haven't tried this, but something similar to the following returned by the Repository interfaces would be ideal. ```cs namespace VCinemaApi.Dtos { public class WatcherDto { public int WatcherId { get; set; } public string Name { get; set; } public static WatcherDto ToWatcherIdAndName(Watcher watcher) { return new WatcherDto { WatcherId = watcher.WatcherId, Name = watcher.Name }; } } } ```
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TerribleCodeClub/VCinema#5
No description provided.