Answer the question
In order to leave comments, you need to log in
What is the pattern for the data access layer?
Hello! For the data access layer, I chose the data table gateway, there is such a model
public class Player
{
public int Id { get; set; }
public string Name { get; set; }
public int Age { get; set; }
public string Position { get; set; }
public int? TeamId { get; set; }
public Team Team { get; set; }
}
public class Team
{
public int Id { get; set; }
public string Name { get; set; }
public string Coach { get; set; }
public ICollection<Player> Players { get; set; }
public Team()
{
Players = new List<Player>();
}
}
Answer the question
In order to leave comments, you need to log in
Service Pattern + Inversion of control. We return Dto (Data transfer object) from the service layer, always, since we follow the canons. If you want to return Team with Player, just create a method in the service and implement the logic in the body of the function
List<TeamPlayer> GetTeamPlayers(int teamId)
{
//logic
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question