public CowsAndChickenGameService(ICowsAndChickenContext ctx, INumberGenerator numberGenerator) { _ctx = ctx ?? throw new ArgumentNullException(nameof(ctx)); _numberGenerator = numberGenerator ?? throw new ArgumentNullException(nameof(numberGenerator)); }
private static readonly List <DomainModel.Player> _activePlayers = new List <DomainModel.Player>(); // TODO: replace with proper cache that handles expiration etc public CowsAndChickenGameService(ICowsAndChickenContext ctx) : this(ctx, new NumberGenerator()) { // The default constructor allows the CowsAndChickenGameService to function as a proper Application Service, i.e. a service that can be used to interact with the Domain Model without // requiring any knowlegde of how that Domain Model works. That is why we are explicitly providing a way to instantiate CowsAndChickenGameService without having to provide an INumberGenerator }