D
D
Dmitry2016-12-30 20:29:41
ASP.NET
Dmitry, 2016-12-30 20:29:41

Patter Gateway data table how to use correctly?

Hello! Understanding the Fowler Data Table Gateway pattern, for example, we have such a model

public class Team
    {
        public string Name { get; set; }

        public ICollection<Player> Players { get; set; }
    }

    public class Player
    {
        public string Name { get; set; }
    }

and there are two data table gates
public class TeamGateAway
    {
        public void Add(Team team);
    }

    public class PlayerGateAway
    {
        public void Add(Player player);
    }

now the question is, when creating a Team, we use the TeamGateAway.Add method and Team is added to the database, but here's what to do with the Player collection which is in the Team object, for it separately use PlayerGateAway.Add or TeamGateAway.Add and when adding Team, the collection will be added Player, in general, the essence of the question is which data table gateway to use if you are working with nested objects, the gateway of the parent object, or to divide one gateway for the parent object, for nested another gateway, i.e. the gateway must save a purely one object without nested ones, or it can save nested ones too? I hope I explained the problem clearly, tell me how it will be more correct

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question