You can divide your service into requests and commands.
Query operations return a smooth, denormalized representation of your data that is easily consumed by your customers. Command operations accept commands containing only the information necessary to execute the command.
, , , , . , , HasLike, -, ( -). , , ; HasLikes true false , .
, , (Person, Movie, MovieLike), , / ; , . :
public IEnumerable<MovieSummary> GetAll()
{
return unit.DbSet<Movie>();
}
public class MovieSummary
{
public int MovieID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public bool HasLike { get; set; }
}
...
public MovieDetails Get(int id)
{
}
public class MovieDetails
{
public int MovieID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public ICollection<MovieLikes> Likes { get; set; }
}
, , .