/// <summary> /// Initializes a new instance of the <see cref="SportDataProvider"/> class /// </summary> /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> used to construct <see cref="ITournament"/> instances</param> /// <param name="sportEventCache">A <see cref="ISportEventCache"/> used to retrieve schedules for sport events</param> /// <param name="sportEventStatusCache">A <see cref="ISportEventStatusCache"/> used to retrieve status for sport event</param> /// <param name="profileCache">A <see cref="IProfileCache"/> used to retrieve competitor or player profile</param> /// <param name="sportDataCache">A <see cref="ISportDataCache"/> used to retrieve sport data</param> /// <param name="defaultCultures"> A <see cref="IList{CultureInfo}"/> specified as default cultures (from configuration)</param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> enum member specifying enum member specifying how instances provided by the current provider will handle exceptions</param> /// <param name="cacheManager">A <see cref="ICacheManager"/> used to interact among caches</param> /// <param name="matchStatusCache">A <see cref="ILocalizedNamedValueCache"/> used to retrieve match statuses</param> /// <param name="dataRouterManager">A <see cref="IDataRouterManager"/> used to invoke API requests</param> public SportDataProvider(ISportEntityFactory sportEntityFactory, ISportEventCache sportEventCache, ISportEventStatusCache sportEventStatusCache, IProfileCache profileCache, ISportDataCache sportDataCache, IEnumerable <CultureInfo> defaultCultures, ExceptionHandlingStrategy exceptionStrategy, ICacheManager cacheManager, ILocalizedNamedValueCache matchStatusCache, IDataRouterManager dataRouterManager) { Guard.Argument(sportEntityFactory, nameof(sportEntityFactory)).NotNull(); Guard.Argument(sportEventCache, nameof(sportEventCache)).NotNull(); Guard.Argument(profileCache, nameof(profileCache)).NotNull(); Guard.Argument(defaultCultures, nameof(defaultCultures)).NotNull().NotEmpty(); Guard.Argument(cacheManager, nameof(cacheManager)).NotNull(); Guard.Argument(matchStatusCache, nameof(matchStatusCache)).NotNull(); Guard.Argument(dataRouterManager, nameof(dataRouterManager)).NotNull(); _sportEntityFactory = sportEntityFactory; _sportEventCache = sportEventCache; _sportEventStatusCache = sportEventStatusCache; _profileCache = profileCache; _sportDataCache = sportDataCache; _defaultCultures = defaultCultures as IReadOnlyCollection <CultureInfo>; _exceptionStrategy = exceptionStrategy; _cacheManager = cacheManager; _matchStatusCache = matchStatusCache; _dataRouterManager = dataRouterManager; }
/// <summary> /// Initializes a new instance of the <see cref="Competitor"/> class /// </summary> /// <param name="competitorId">A competitor id used to create new instance</param> /// <param name="profileCache">A <see cref="IProfileCache"/> used for fetching profile data</param> /// <param name="cultures">A cultures of the current instance of <see cref="CompetitorCI"/></param> /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> used to retrieve <see cref="IPlayerProfile"/></param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> used in sport entity factory</param> /// <param name="competitorsReferences">A list of <see cref="ReferenceIdCI"/> for all competitors</param> public Competitor(URN competitorId, IProfileCache profileCache, IEnumerable <CultureInfo> cultures, ISportEntityFactory sportEntityFactory, ExceptionHandlingStrategy exceptionStrategy, IDictionary <URN, ReferenceIdCI> competitorsReferences) : base(competitorId, new Dictionary <CultureInfo, string>()) { Guard.Argument(competitorId, nameof(competitorId)).NotNull(); Guard.Argument(profileCache, nameof(profileCache)).NotNull(); Guard.Argument(cultures, nameof(cultures)).NotNull(); Guard.Argument(sportEntityFactory, nameof(sportEntityFactory)).NotNull(); _competitorId = competitorId; _competitorCI = null; _profileCache = profileCache; _cultures = cultures.ToList(); _sportEntityFactory = sportEntityFactory; _exceptionStrategy = exceptionStrategy; _competitionCI = null; _referenceId = null; if (competitorsReferences != null && competitorsReferences.Any()) { if (competitorsReferences.TryGetValue(competitorId, out var q)) { _referenceId = q; } } }
/// <summary> /// Initializes a new instance of the <see cref="Competitor"/> class /// </summary> /// <param name="ci">A <see cref="CompetitorCI"/> used to create new instance</param> /// <param name="profileCache">A <see cref="IProfileCache"/> used for fetching profile data</param> /// <param name="cultures">A cultures of the current instance of <see cref="CompetitorCI"/></param> /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> used to retrieve <see cref="IPlayerProfile"/></param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> used in sport entity factory</param> /// <param name="rootCompetitionCI">A root <see cref="CompetitionCI"/> to which this competitor belongs to</param> public Competitor(CompetitorCI ci, IProfileCache profileCache, IEnumerable <CultureInfo> cultures, ISportEntityFactory sportEntityFactory, ExceptionHandlingStrategy exceptionStrategy, ICompetitionCI rootCompetitionCI) : base(ci.Id, new Dictionary <CultureInfo, string>()) { Guard.Argument(cultures, nameof(cultures)).NotNull(); if (!cultures.Any()) { throw new ArgumentOutOfRangeException(nameof(cultures)); } Guard.Argument(sportEntityFactory, nameof(sportEntityFactory)).NotNull(); _competitorId = ci.Id; _competitorCI = ci; _profileCache = profileCache; _cultures = cultures.ToList(); _sportEntityFactory = sportEntityFactory; _exceptionStrategy = exceptionStrategy; _competitionCI = (CompetitionCI)rootCompetitionCI; _referenceId = null; }
/// <summary> /// Initializes a new instance of the <see cref="Competitor"/> class /// </summary> /// <param name="ci">A <see cref="CompetitorCI"/> used to create new instance</param> /// <param name="profileCache">A <see cref="IProfileCache"/> used for fetching profile data</param> /// <param name="cultures">A cultures of the current instance of <see cref="CompetitorCI"/></param> /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> used to retrieve <see cref="IPlayerProfile"/></param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> used in sport entity factory</param> /// <param name="rootCompetitionCI">A root <see cref="CompetitionCI"/> to which this competitor belongs to</param> public Competitor(CompetitorCI ci, IProfileCache profileCache, IEnumerable <CultureInfo> cultures, ISportEntityFactory sportEntityFactory, ExceptionHandlingStrategy exceptionStrategy, ICompetitionCI rootCompetitionCI) : base(ci.Id, new Dictionary <CultureInfo, string>()) { //Guard.Argument(ci, nameof(ci)).NotNull(); Guard.Argument(cultures, nameof(cultures)).NotNull();//.NotEmpty(); if (!cultures.Any()) { throw new ArgumentOutOfRangeException(nameof(cultures)); } Guard.Argument(sportEntityFactory, nameof(sportEntityFactory)).NotNull(); if (ci == null) { // above contract requirement throws even when ci in fact not null throw new ArgumentNullException(nameof(ci)); } _competitorCI = ci; _profileCache = profileCache; _cultures = cultures.ToList(); _sportEntityFactory = sportEntityFactory; _exceptionStrategy = exceptionStrategy; _competitionCI = (CompetitionCI)rootCompetitionCI; _referenceId = null; }
/// <summary> /// Initializes a new instance of the <see cref="FeedMessageMapper" /> class /// </summary> /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> implementation used to construct <see cref="ISportEvent"/> instances</param> /// <param name="nameProviderFactory">A <see cref="INameProviderFactory"/> instance used build <see cref="INameProvider"/> instances used to get/create market/outcome names</param> /// <param name="mappingProviderFactory">A factory used to construct <see cref="IMarketMappingProvider"/> instances</param> /// <param name="namedValuesProvider">A <see cref="INamedValuesProvider"/> used to obtain descriptions for named values</param> /// <param name="externalExceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> enum member specifying how the publicly available instance constructed by current instance should handle potential exceptions</param> /// <param name="producerManager">An <see cref="IProducerManager"/> used to get <see cref="IProducer"/></param> /// <param name="marketCacheProvider">The SDK market cache provider used to retrieve market data</param> /// <param name="voidReasonCache">A <see cref="INamedValueCache"/> for possible void reasons</param> public FeedMessageMapper(ISportEntityFactory sportEntityFactory, INameProviderFactory nameProviderFactory, IMarketMappingProviderFactory mappingProviderFactory, INamedValuesProvider namedValuesProvider, ExceptionHandlingStrategy externalExceptionStrategy, IProducerManager producerManager, IMarketCacheProvider marketCacheProvider, INamedValueCache voidReasonCache) { Guard.Argument(sportEntityFactory, nameof(sportEntityFactory)).NotNull(); Guard.Argument(nameProviderFactory, nameof(nameProviderFactory)).NotNull(); Guard.Argument(namedValuesProvider, nameof(namedValuesProvider)).NotNull(); Guard.Argument(producerManager, nameof(producerManager)).NotNull(); Guard.Argument(marketCacheProvider, nameof(marketCacheProvider)).NotNull(); Guard.Argument(voidReasonCache, nameof(voidReasonCache)).NotNull(); _nameProviderFactory = nameProviderFactory; _sportEntityFactory = sportEntityFactory; _mappingProviderFactory = mappingProviderFactory; _namedValuesProvider = namedValuesProvider; _externalExceptionStrategy = externalExceptionStrategy; _producerManager = producerManager; _marketCacheProvider = marketCacheProvider; _voidReasonCache = voidReasonCache; }
public CurrentSeasonInfo(CurrentSeasonInfoCI cacheItem, IEnumerable <CultureInfo> cultures, ISportEntityFactory sportEntityFactory, ExceptionHandlingStrategy exceptionHandlingStrategy, IDictionary <URN, ReferenceIdCI> competitorsReferenceIds) { Guard.Argument(cacheItem, nameof(cacheItem)).NotNull(); //Guard.Argument(sportEntityFactory, nameof()).NotNull(); var cultureInfos = cultures as IList <CultureInfo> ?? cultures.ToList(); Id = cacheItem.Id; Names = cacheItem.Name as IReadOnlyDictionary <CultureInfo, string>; Year = cacheItem.Year; StartDate = cacheItem.StartDate; EndDate = cacheItem.EndDate; Coverage = cacheItem.SeasonCoverage == null ? null : new SeasonCoverage(cacheItem.SeasonCoverage); Groups = cacheItem.Groups == null ? null : cacheItem.Groups.Select(s => new Group(s, cultureInfos, sportEntityFactory, exceptionHandlingStrategy, competitorsReferenceIds)); CurrentRound = cacheItem.CurrentRound == null ? null : new Round(cacheItem.CurrentRound, cultureInfos); Competitors = cacheItem.Competitors == null ? null : cacheItem.Competitors.Select(s => sportEntityFactory.BuildCompetitor(s, cultureInfos, competitorsReferenceIds, exceptionHandlingStrategy)); Schedule = cacheItem.Schedule == null ? null : cacheItem.Schedule.Select(s => sportEntityFactory.BuildSportEvent <ISportEvent>(s, null, cultureInfos, exceptionHandlingStrategy)); }
public CurrentSeasonInfo(ITournamentInfoCI currentSeasonCI, IEnumerable <CultureInfo> cultures, ISportEntityFactory sportEntityFactory, ExceptionHandlingStrategy exceptionStrategy, IDictionary <URN, ReferenceIdCI> competitorsReferenceIds) { var cultureInfos = cultures as IList <CultureInfo> ?? cultures.ToList(); Id = currentSeasonCI.Id; Names = currentSeasonCI.GetNamesAsync(cultureInfos).Result; Year = currentSeasonCI.GetYearAsync().Result; StartDate = currentSeasonCI.GetScheduledAsync().Result ?? DateTime.MinValue; EndDate = currentSeasonCI.GetScheduledEndAsync().Result ?? DateTime.MinValue; Coverage = currentSeasonCI.GetSeasonCoverageAsync().Result == null ? null : new SeasonCoverage(currentSeasonCI.GetSeasonCoverageAsync().Result); Groups = currentSeasonCI.GetGroupsAsync(cultureInfos).Result == null ? null : currentSeasonCI.GetGroupsAsync(cultureInfos).Result.Select(s => new Group(s, cultureInfos, sportEntityFactory, exceptionStrategy, competitorsReferenceIds)); CurrentRound = currentSeasonCI.GetCurrentRoundAsync(cultureInfos).Result == null ? null : new Round(currentSeasonCI.GetCurrentRoundAsync(cultureInfos).Result, cultureInfos); Competitors = currentSeasonCI.GetCompetitorsAsync(cultureInfos).Result == null ? null : currentSeasonCI.GetCompetitorsAsync(cultureInfos).Result.Select(s => sportEntityFactory.BuildCompetitor(s, cultureInfos, competitorsReferenceIds, exceptionStrategy)); Schedule = currentSeasonCI.GetScheduleAsync(cultureInfos).Result == null ? null : currentSeasonCI.GetScheduleAsync(cultureInfos).Result.Select(s => sportEntityFactory.BuildSportEvent <ISportEvent>(s, null, cultureInfos, exceptionStrategy)); }
/// <summary> /// Initializes a new instance of the <see cref="Group"/> class /// </summary> /// <param name="ci">A <see cref="GroupCI"/> used to create new instance</param> /// <param name="cultures">A culture of the current instance of <see cref="GroupDTO"/></param> /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> used to retrieve <see cref="IPlayerProfile"/></param> /// <param name="competitorsReferenceIds">A list of <see cref="ReferenceIdCI"/> for all competitors</param> public Group(GroupCI ci, IEnumerable <CultureInfo> cultures, ISportEntityFactory sportEntityFactory, IDictionary <URN, ReferenceIdCI> competitorsReferenceIds) { Guard.Argument(ci, nameof(ci)).NotNull(); Id = ci.Id; Name = ci.Name; if (ci.Competitors != null) { //var competitors = new List<ICompetitor>(); //var cultureInfos = cultures.ToList(); //foreach (CompetitorCI competitorCI in ci.Competitors) //{ // if (competitorCI == null) // { // var x = "2"; // } // var comp = new Competitor(competitorCI, cultureInfos, sportEntityFactory, competitorsReferenceIds); // competitors.Add(comp); //} //_competitors = competitors; _competitors = ci.Competitors.Select(t => sportEntityFactory.BuildCompetitor(t, cultures, competitorsReferenceIds)).ToList(); } }
/// <summary> /// Initializes a new instance of the <see cref="SportDataProvider"/> class /// </summary> /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> used to construct <see cref="ITournament"/> instances</param> /// <param name="sportEventCache">A <see cref="ISportEventCache"/> used to retrieve schedules for sport events</param> /// <param name="sportEventStatusCache">A <see cref="ISportEventStatusCache"/> used to retrieve status for sport event</param> /// <param name="profileCache">A <see cref="IProfileCache"/> ued to retrieve competitor or player profile</param> /// <param name="defaultCultures"> A <see cref="IList{CultureInfo}"/> specified as default cultures (from configuration)</param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> enum member specifying enum member specifying how instances provided by the current provider will handle exceptions</param> /// <param name="cacheManager">A <see cref="ICacheManager"/> used to interact among caches</param> /// <param name="matchStatusCache">A <see cref="ILocalizedNamedValueCache"/> used to retrieve match statuses</param> public SportDataProvider(ISportEntityFactory sportEntityFactory, ISportEventCache sportEventCache, ISportEventStatusCache sportEventStatusCache, IProfileCache profileCache, IEnumerable <CultureInfo> defaultCultures, ExceptionHandlingStrategy exceptionStrategy, ICacheManager cacheManager, ILocalizedNamedValueCache matchStatusCache, IDataRouterManager dataRouterManager) { Contract.Requires(sportEntityFactory != null); Contract.Requires(sportEventCache != null); Contract.Requires(profileCache != null); Contract.Requires(defaultCultures != null); Contract.Requires(defaultCultures.Any()); Contract.Requires(cacheManager != null); Contract.Requires(matchStatusCache != null); Contract.Requires(dataRouterManager != null); _sportEntityFactory = sportEntityFactory; _sportEventCache = sportEventCache; _sportEventStatusCache = sportEventStatusCache; _profileCache = profileCache; _defaultCultures = defaultCultures as IReadOnlyCollection <CultureInfo>; _exceptionStrategy = exceptionStrategy; _cacheManager = cacheManager; _matchStatusCache = matchStatusCache; _dataRouterManager = dataRouterManager; }
/// <summary> /// Initializes a new instance of the <see cref="FeedMessageMapper" /> class /// </summary> /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> implementation used to construct <see cref="ISportEvent"/> instances</param> /// <param name="nameProviderFactory">A <see cref="INameProviderFactory"/> instance used build <see cref="INameProvider"/> instances used to get/create market/outcome names</param> /// <param name="mappingProviderFactory">A factory used to construct <see cref="IMarketMappingProvider"/> instances</param> /// <param name="namedValuesProvider">A <see cref="INamedValuesProvider"/> used to obtain descriptions for named values</param> /// <param name="externalExceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> enum member specifying how the publicly available instance constructed by current instance should handle potential exceptions</param> /// <param name="producerManager">An <see cref="IProducerManager"/> used to get <see cref="IProducer"/></param> /// <param name="marketCacheProvider">The SDK market cache provider used to retrieve market data</param> /// <param name="voidReasonCache">A <see cref="INamedValueCache"/> for possible void reasons</param> public FeedMessageMapper(ISportEntityFactory sportEntityFactory, INameProviderFactory nameProviderFactory, IMarketMappingProviderFactory mappingProviderFactory, INamedValuesProvider namedValuesProvider, ExceptionHandlingStrategy externalExceptionStrategy, IProducerManager producerManager, IMarketCacheProvider marketCacheProvider, INamedValueCache voidReasonCache) { Contract.Requires(sportEntityFactory != null); Contract.Requires(nameProviderFactory != null); Contract.Requires(namedValuesProvider != null); Contract.Requires(producerManager != null); Contract.Requires(marketCacheProvider != null); Contract.Requires(voidReasonCache != null); _nameProviderFactory = nameProviderFactory; _sportEntityFactory = sportEntityFactory; _mappingProviderFactory = mappingProviderFactory; _namedValuesProvider = namedValuesProvider; _externalExceptionStrategy = externalExceptionStrategy; _producerManager = producerManager; _marketCacheProvider = marketCacheProvider; _voidReasonCache = voidReasonCache; }
/// <summary> /// Initializes a new instance of the <see cref="TeamCompetitor"/> class /// </summary> /// <param name="ci">A <see cref="TeamCompetitorCI"/> used to create new instance</param> /// <param name="culture">A culture of the current instance of <see cref="TeamCompetitorCI"/></param> /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> used to retrieve <see cref="IPlayer"/></param> /// <param name="profileCache">A <see cref="IProfileCache"/> used for fetching profile data</param> /// <param name="rootCompetitionCI">A root <see cref="CompetitionCI"/> to which this competitor belongs to</param> public TeamCompetitor(TeamCompetitorCI ci, IEnumerable <CultureInfo> culture, ISportEntityFactory sportEntityFactory, IProfileCache profileCache, ICompetitionCI rootCompetitionCI) : base(ci, profileCache, culture, sportEntityFactory, rootCompetitionCI) { Division = ci.Division; }
public SoccerEvent(URN id, URN sportId, ISportEntityFactory sportEntityFactory, ISportEventCache sportEventCache, ISportEventStatusCache sportEventStatusCache, ILocalizedNamedValueCache matchStatusCache, IEnumerable <CultureInfo> cultures, ExceptionHandlingStrategy exceptionStrategy) : base(id, sportId, sportEntityFactory, sportEventCache, sportEventStatusCache, matchStatusCache, cultures, exceptionStrategy) { }
/// <summary> /// Initializes a new instance of the <see cref="Match"/> class. /// </summary> /// <param name="id">A <see cref="URN"/> uniquely identifying the match associated with the current instance</param> /// <param name="sportId">A <see cref="URN"/> uniquely identifying the sport associated with the current instance</param> /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> instance used to construct <see cref="ITournament"/> instances</param> /// <param name="sportEventCache">A <see cref="ISportEventCache"/> instances containing cache data associated with the current instance</param> /// <param name="sportEventStatusCache">A <see cref="ISportEventStatusCache"/> instance containing cache data information about the progress of a match associated with the current instance</param> /// <param name="matchStatusCache">A localized match statuses cache</param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying languages the current instance supports</param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> enum member specifying how the initialized instance will handle potential exceptions</param> public Match(URN id, URN sportId, ISportEntityFactory sportEntityFactory, ISportEventCache sportEventCache, ISportEventStatusCache sportEventStatusCache, ILocalizedNamedValueCache matchStatusCache, IEnumerable<CultureInfo> cultures, ExceptionHandlingStrategy exceptionStrategy) : base(ExecutionLogPrivate, id, sportId, sportEntityFactory, sportEventStatusCache, sportEventCache, cultures, exceptionStrategy, matchStatusCache) { _sportEntityFactory = sportEntityFactory; }
/// <summary> /// Initializes a new instance of the <see cref="Group"/> class /// </summary> /// <param name="ci">A <see cref="GroupCI"/> used to create new instance</param> /// <param name="cultures">A culture of the current instance of <see cref="GroupDTO"/></param> /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> used to retrieve <see cref="IPlayerProfile"/></param> /// <param name="exceptionStrategy">The exception strategy</param> /// <param name="competitorsReferenceIds">A list of <see cref="ReferenceIdCI"/> for all competitors</param> public Group(GroupCI ci, IEnumerable <CultureInfo> cultures, ISportEntityFactory sportEntityFactory, ExceptionHandlingStrategy exceptionStrategy, IDictionary <URN, ReferenceIdCI> competitorsReferenceIds) { Guard.Argument(ci, nameof(ci)).NotNull(); Id = ci.Id; Name = ci.Name; if (ci.CompetitorsIds != null) { _competitors = ci.CompetitorsIds.Select(t => sportEntityFactory.BuildCompetitor(t, cultures, competitorsReferenceIds, exceptionStrategy)).ToList(); } }
/// <summary> /// Initializes a new instance of the <see cref="BasicTournament" /> class /// </summary> /// <param name="id">The identifier</param> /// <param name="sportId">The sport identifier</param> /// <param name="sportEntityFactory"> /// An instance of a <see cref="ISportEntityFactory" /> used to create /// <see cref="ISportEvent" /> instances /// </param> /// <param name="sportEventCache">The sport event cache</param> /// <param name="sportDataCache">The sport data cache</param> /// <param name="cultures">The cultures</param> /// <param name="exceptionStrategy">The exception strategy</param> public BasicTournament(URN id, URN sportId, ISportEntityFactory sportEntityFactory, ISportEventCache sportEventCache, ISportDataCache sportDataCache, IEnumerable <CultureInfo> cultures, ExceptionHandlingStrategy exceptionStrategy) : base(id, sportId, ExecutionLogPrivate, sportEventCache, cultures, exceptionStrategy) { Contract.Requires(sportDataCache != null); Contract.Requires(sportEntityFactory != null); _sportEntityFactory = sportEntityFactory; _sportDataCache = sportDataCache; }
/// <summary> /// Initializes a new instance of the <see cref="BasicTournament"/> class /// </summary> /// <param name="id">The identifier</param> /// <param name="sportId">The sport identifier</param> /// <param name="sportEntityFactory">An instance of a <see cref="ISportEntityFactory"/> used to create <see cref="ISportEvent"/> instances</param> /// <param name="sportEventCache">The sport event cache</param> /// <param name="sportDataCache">The sport data cache</param> /// <param name="cultures">The cultures</param> /// <param name="exceptionStrategy">The exception strategy</param> public BasicTournament(URN id, URN sportId, ISportEntityFactory sportEntityFactory, ISportEventCache sportEventCache, ISportDataCache sportDataCache, IEnumerable <CultureInfo> cultures, ExceptionHandlingStrategy exceptionStrategy) : base(id, sportId, ExecutionLogPrivate, sportEventCache, cultures, exceptionStrategy) { Guard.Argument(sportDataCache, nameof(sportDataCache)).NotNull(); Guard.Argument(sportEntityFactory, nameof(sportEntityFactory)).NotNull(); _sportEntityFactory = sportEntityFactory; _sportDataCache = sportDataCache; }
public Stage(URN id, URN sportId, ISportEntityFactory sportEntityFactory, ISportEventCache sportEventCache, ISportDataCache sportDataCache, ISportEventStatusCache sportEventStatusCache, ILocalizedNamedValueCache matchStatusesCache, IEnumerable <CultureInfo> cultures, ExceptionHandlingStrategy exceptionStrategy) : base(ExecutionLogPrivate, id, sportId, sportEntityFactory, sportEventStatusCache, sportEventCache, cultures, exceptionStrategy, matchStatusesCache) { Guard.Argument(sportDataCache, nameof(sportDataCache)).NotNull(); Guard.Argument(matchStatusesCache, nameof(matchStatusesCache)).NotNull(); _sportEntityFactory = sportEntityFactory; _sportDataCache = sportDataCache; }
public Stage(URN id, URN sportId, ISportEntityFactory sportEntityFactory, ISportEventCache sportEventCache, ISportDataCache sportDataCache, ISportEventStatusCache sportEventStatusCache, ILocalizedNamedValueCache matchStatusesCache, IEnumerable <CultureInfo> cultures, ExceptionHandlingStrategy exceptionStrategy) : base(ExecutionLogPrivate, id, sportId, sportEntityFactory, sportEventStatusCache, sportEventCache, cultures, exceptionStrategy, matchStatusesCache) { Contract.Requires(sportDataCache != null); Contract.Requires(matchStatusesCache != null); _sportEntityFactory = sportEntityFactory; _sportDataCache = sportDataCache; _matchStatusesCache = matchStatusesCache; }
/// <summary> /// Initializes a new instance of the <see cref="Competitor"/> class /// </summary> /// <param name="ci">A <see cref="CompetitorCI"/> used to create new instance</param> /// <param name="profileCache">A <see cref="IProfileCache"/> used for fetching profile data</param> /// <param name="cultures">A cultures of the current instance of <see cref="CompetitorCI"/></param> /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> used to retrieve <see cref="IPlayerProfile"/></param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> used in sport entity factory</param> /// <param name="competitorsReferences">A list of <see cref="ReferenceIdCI"/> for all competitors</param> public Competitor(CompetitorCI ci, IProfileCache profileCache, IEnumerable <CultureInfo> cultures, ISportEntityFactory sportEntityFactory, ExceptionHandlingStrategy exceptionStrategy, IDictionary <URN, ReferenceIdCI> competitorsReferences) : base(ci.Id, new Dictionary <CultureInfo, string>()) { //Guard.Argument(ci, nameof()).NotNull(); Guard.Argument(cultures, nameof(cultures)).NotNull().NotEmpty(); Guard.Argument(sportEntityFactory, nameof(sportEntityFactory)).NotNull(); if (ci == null) { // above contract requirement throws even when ci in fact not null throw new ArgumentNullException(nameof(ci)); } _competitorCI = ci; _profileCache = profileCache; _cultures = cultures.ToList(); _sportEntityFactory = sportEntityFactory; _exceptionStrategy = exceptionStrategy; _competitionCI = null; _referenceId = null; if (competitorsReferences != null && competitorsReferences.Any()) { ReferenceIdCI q; if (competitorsReferences.TryGetValue(ci.Id, out q)) { _referenceId = q; } } else { if (ci.ReferenceId != null) { _referenceId = ci.ReferenceId; } } }
/// <summary> /// Initializes a new instance of the <see cref="Competition"/> class /// </summary> /// <param name="executionLog">A <see cref="ILogger"/> instance used for execution logging</param> /// <param name="id">A <see cref="URN"/> uniquely identifying the sport event associated with the current instance</param> /// <param name="sportId">A <see cref="URN"/> uniquely identifying the sport associated with the current instance</param> /// <param name="sportEntityFactory">An instance of a <see cref="ISportEntityFactory"/> used to create <see cref="ISportEvent"/> instances</param> /// <param name="sportEventStatusCache">A <see cref="ISportEventStatusCache"/> instance containing cache data information about the progress of a sport event associated with the current instance</param> /// <param name="sportEventCache">A <see cref="ISportEventCache"/> instance containing <see cref="CompetitionCI"/></param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying languages the current instance supports</param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> enum member specifying how the initialized instance will handle potential exceptions</param> /// <param name="matchStatusesCache">A <see cref="ILocalizedNamedValueCache"/> cache for fetching match statuses</param> internal Competition(ILogger executionLog, URN id, URN sportId, ISportEntityFactory sportEntityFactory, ISportEventStatusCache sportEventStatusCache, ISportEventCache sportEventCache, IEnumerable <CultureInfo> cultures, ExceptionHandlingStrategy exceptionStrategy, ILocalizedNamedValueCache matchStatusesCache) : base(id, sportId, executionLog, sportEventCache, cultures, exceptionStrategy) { Guard.Argument(id, nameof(id)).NotNull(); Guard.Argument(sportEntityFactory, nameof(sportEntityFactory)).NotNull(); Guard.Argument(sportEventStatusCache, nameof(sportEventStatusCache)).NotNull(); Guard.Argument(matchStatusesCache, nameof(matchStatusesCache)).NotNull(); _sportEntityFactory = sportEntityFactory; SportEventStatusCache = sportEventStatusCache; _matchStatusesCache = matchStatusesCache; }
/// <summary> /// Initializes a new instance of the <see cref="Competition"/> class /// </summary> /// <param name="executionLog">A <see cref="ILog"/> instance used for execution logging</param> /// <param name="id">A <see cref="URN"/> uniquely identifying the sport event associated with the current instance</param> /// <param name="sportId">A <see cref="URN"/> uniquely identifying the sport associated with the current instance</param> /// <param name="sportEntityFactory">An instance of a <see cref="ISportEntityFactory"/> used to create <see cref="ISportEvent"/> instances</param> /// <param name="sportEventStatusCache">A <see cref="ISportEventStatusCache"/> instance containing cache data information about the progress of a sport event associated with the current instance</param> /// <param name="sportEventCache">A <see cref="ISportEventCache"/> instance containing <see cref="CompetitionCI"/></param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying languages the current instance supports</param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> enum member specifying how the initialized instance will handle potential exceptions</param> /// <param name="matchStatusesCache">A <see cref="ILocalizedNamedValueCache"/> cache for fetching match statuses</param> internal Competition(ILog executionLog, URN id, URN sportId, ISportEntityFactory sportEntityFactory, ISportEventStatusCache sportEventStatusCache, ISportEventCache sportEventCache, IEnumerable <CultureInfo> cultures, ExceptionHandlingStrategy exceptionStrategy, ILocalizedNamedValueCache matchStatusesCache) : base(id, sportId, executionLog, sportEventCache, cultures, exceptionStrategy) { Contract.Requires(id != null); Contract.Requires(sportEntityFactory != null); Contract.Requires(sportEventStatusCache != null); Contract.Requires(matchStatusesCache != null); _sportEntityFactory = sportEntityFactory; SportEventStatusCache = sportEventStatusCache; _matchStatusesCache = matchStatusesCache; }
/// <summary> /// Initializes a new instance of the <see cref="Competitor" /> class /// </summary> /// <param name="ci">A <see cref="CompetitorCI" /> used to create new instance</param> /// <param name="profileCache">A <see cref="IProfileCache" /> used for fetching profile data</param> /// <param name="cultures">A cultures of the current instance of <see cref="CompetitorCI" /></param> /// <param name="sportEntityFactory"> /// A <see cref="ISportEntityFactory" /> used to retrieve <see cref="IPlayerProfile" /> /// </param> /// <param name="rootCompetitionCI">A root <see cref="CompetitionCI" /> to which this competitor belongs to</param> public Competitor(CompetitorCI ci, IProfileCache profileCache, IEnumerable <CultureInfo> cultures, ISportEntityFactory sportEntityFactory, ICompetitionCI rootCompetitionCI) : base(ci.Id, new Dictionary <CultureInfo, string>()) { //Contract.Requires(ci != null); Contract.Requires(cultures != null && cultures.Any()); Contract.Requires(sportEntityFactory != null); if (ci == null) { // above contract requirement throws even when ci in fact not null throw new ArgumentNullException(nameof(ci)); } _competitorCI = ci; _profileCache = profileCache; _cultures = cultures.ToList(); _sportEntityFactory = sportEntityFactory; _competitionCI = (CompetitionCI)rootCompetitionCI; _referenceId = null; }