Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CompetitionCI" /> class
        /// </summary>
        /// <param name="exportable">A <see cref="ExportableSportEventCI" /> representing the sport event</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
        /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
        /// <param name="defaultCulture">A <see cref="CultureInfo" /> specifying the language used when fetching info which is not translatable (e.g. Scheduled, ..)</param>
        /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixture timestamps</param>
        public CompetitionCI(ExportableSportEventCI exportable,
                             IDataRouterManager dataRouterManager,
                             ISemaphorePool semaphorePool,
                             CultureInfo defaultCulture,
                             MemoryCache fixtureTimestampCache)
            : base(exportable, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
        {
            Guard.Argument(exportable, nameof(exportable)).NotNull();

            var exportableCompetition = exportable as ExportableCompetitionCI;

            if (exportableCompetition != null)
            {
                _bookingStatus = exportableCompetition.BookingStatus;
                _venue         = exportableCompetition.Venue != null ? new VenueCI(exportableCompetition.Venue) : null;
                _conditions    = exportableCompetition.Conditions != null
                    ? new SportEventConditionsCI(exportableCompetition.Conditions)
                    : null;
                Competitors = exportableCompetition.Competitors != null
                    ? new List <URN>(exportableCompetition.Competitors.Select(URN.Parse))
                    : null;
                _referenceId = exportableCompetition.ReferenceId != null
                    ? new ReferenceIdCI(exportableCompetition.ReferenceId)
                    : null;
                _competitorsQualifiers = exportableCompetition.CompetitorsQualifiers != null
                    ? new Dictionary <URN, string>(
                    exportableCompetition.CompetitorsQualifiers.ToDictionary(c => URN.Parse(c.Key), c => c.Value))
                    : null;
                _competitorsReferences = exportableCompetition.CompetitorsReferences != null
                    ? new Dictionary <URN, ReferenceIdCI>(
                    exportableCompetition.CompetitorsReferences.ToDictionary(c => URN.Parse(c.Key),
                                                                             c => new ReferenceIdCI(c.Value)))
                    : null;
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TournamentInfoCI"/> class
 /// </summary>
 /// <param name="exportable">A <see cref="ExportableTournamentInfoCI" /> specifying the current instance</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
 /// <param name="defaultCulture">A <see cref="CultureInfo" /> specifying the language used when fetching info which is not translatable (e.g. Scheduled, ..)</param>
 /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixture timestamps</param>
 public TournamentInfoCI(ExportableTournamentInfoCI exportable,
                         IDataRouterManager dataRouterManager,
                         ISemaphorePool semaphorePool,
                         CultureInfo defaultCulture,
                         MemoryCache fixtureTimestampCache)
     : base(exportable, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
 {
     _categoryId         = exportable.CategoryId == null ? null : URN.Parse(exportable.CategoryId);
     _tournamentCoverage = exportable.TournamentCoverage != null
         ? new TournamentCoverageCI(exportable.TournamentCoverage)
         : null;
     _competitors       = exportable.Competitors?.Select(c => new CompetitorCI(c, dataRouterManager)).ToList();
     _currentSeasonInfo = exportable.CurrentSeasonInfo != null
         ? new CurrentSeasonInfoCI(exportable.CurrentSeasonInfo, dataRouterManager)
         : null;
     _groups              = exportable.Groups?.Select(g => new GroupCI(g, dataRouterManager)).ToList();
     _scheduleUrns        = exportable.ScheduleUrns?.Select(URN.Parse).ToList();
     _round               = exportable.Round != null ? new RoundCI(exportable.Round) : null;
     _year                = exportable.Year;
     _tournamentInfoBasic = exportable.TournamentInfoBasic != null
         ? new TournamentInfoBasicCI(exportable.TournamentInfoBasic, dataRouterManager)
         : null;
     _referenceId    = exportable.ReferenceId != null ? new ReferenceIdCI(exportable.ReferenceId) : null;
     _seasonCoverage = exportable.SeasonCoverage != null
         ? new SeasonCoverageCI(exportable.SeasonCoverage)
         : null;
     _seasons               = exportable.Seasons?.Select(URN.Parse).ToList();
     _loadedSeasons         = new List <CultureInfo>(exportable.LoadedSeasons ?? new List <CultureInfo>());
     _loadedSchedules       = new List <CultureInfo>(exportable.LoadedSchedules ?? new List <CultureInfo>());
     _competitorsReferences =
         exportable.CompetitorsReferences?.ToDictionary(c => URN.Parse(c.Key), c => new ReferenceIdCI(c.Value));
     _exhibitionGames = exportable.ExhibitionGames;
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StageCI"/> class
 /// </summary>
 /// <param name="id">The identifier</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">The semaphore pool</param>
 /// <param name="defaultCulture">The default culture</param>
 /// <param name="fixtureTimestampCache">A <see cref="ObjectCache"/> used to cache the sport events fixture timestamps</param>
 public StageCI(URN id,
                IDataRouterManager dataRouterManager,
                ISemaphorePool semaphorePool,
                CultureInfo defaultCulture,
                ObjectCache fixtureTimestampCache)
     : base(id, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MatchCI"/> class
 /// </summary>
 /// <param name="id">A <see cref="URN" /> specifying the id of the sport event associated with the current instance</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
 /// <param name="defaultCulture">A <see cref="CultureInfo" /> specifying the language used when fetching info which is not translatable (e.g. Scheduled, ..)</param>
 /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixture timestamps</param>
 public MatchCI(URN id,
                IDataRouterManager dataRouterManager,
                ISemaphorePool semaphorePool,
                CultureInfo defaultCulture,
                MemoryCache fixtureTimestampCache)
     : base(id, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
 {
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StageCI"/> class
 /// </summary>
 /// <param name="tournamentSummary">The tournament summary</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">The semaphore pool</param>
 /// <param name="currentCulture">The current culture</param>
 /// <param name="defaultCulture">The default culture</param>
 /// <param name="fixtureTimestampCache">A <see cref="ObjectCache"/> used to cache the sport events fixture timestamps</param>
 public StageCI(TournamentInfoDTO tournamentSummary,
                IDataRouterManager dataRouterManager,
                ISemaphorePool semaphorePool,
                CultureInfo currentCulture,
                CultureInfo defaultCulture,
                ObjectCache fixtureTimestampCache)
     : base(tournamentSummary, dataRouterManager, semaphorePool, currentCulture, defaultCulture, fixtureTimestampCache)
 {
     Merge(tournamentSummary, currentCulture, true);
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MatchCI"/> class
 /// </summary>
 /// <param name="eventSummary">The event summary</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">The semaphore pool</param>
 /// <param name="currentCulture">The current culture</param>
 /// <param name="defaultCulture">The default culture</param>
 /// <param name="fixtureTimestampCache">A <see cref="ObjectCache"/> used to cache the sport events fixture timestamps</param>
 public MatchCI(MatchDTO eventSummary,
                IDataRouterManager dataRouterManager,
                ISemaphorePool semaphorePool,
                CultureInfo currentCulture,
                CultureInfo defaultCulture,
                ObjectCache fixtureTimestampCache)
     : base(eventSummary, dataRouterManager, semaphorePool, currentCulture, defaultCulture, fixtureTimestampCache)
 {
     Merge(eventSummary, currentCulture, true);
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LotteryCI"/> class
 /// </summary>
 /// <param name="id">A <see cref="URN" /> specifying the id of the sport event associated with the current instance</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
 /// <param name="defaultCulture">A <see cref="CultureInfo" /> specifying the language used when fetching info which is not translatable (e.g. Scheduled, ..)</param>
 /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixture timestamps</param>
 public LotteryCI(URN id,
                  IDataRouterManager dataRouterManager,
                  ISemaphorePool semaphorePool,
                  CultureInfo defaultCulture,
                  MemoryCache fixtureTimestampCache)
     : base(id, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
 {
     _scheduleFetched   = false;
     _dataRouterManager = dataRouterManager;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MatchCI"/> class
 /// </summary>
 /// <param name="fixture">The fixture data</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">The semaphore pool</param>
 /// <param name="currentCulture">The current culture</param>
 /// <param name="defaultCulture">The default culture</param>
 /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixture timestamps</param>
 public MatchCI(FixtureDTO fixture,
                 IDataRouterManager dataRouterManager,
                 ISemaphorePool semaphorePool,
                 CultureInfo currentCulture,
                 CultureInfo defaultCulture,
                 MemoryCache fixtureTimestampCache)
     : base(fixture, dataRouterManager, semaphorePool, currentCulture, defaultCulture, fixtureTimestampCache)
 {
     Merge(fixture, currentCulture, true);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TournamentInfoCI"/> class
 /// </summary>
 /// <param name="fixture">The fixture data</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
 /// <param name="currentCulture">A <see cref="CultureInfo" /> of the <see cref="SportEventSummaryDTO" /> instance</param>
 /// <param name="defaultCulture">A <see cref="CultureInfo" /> specifying the language used when fetching info which is not translatable (e.g. Scheduled, ..)</param>
 /// <param name="fixtureTimestampCache">A <see cref="ObjectCache"/> used to cache the sport events fixture timestamps</param>
 public TournamentInfoCI(FixtureDTO fixture,
                         IDataRouterManager dataRouterManager,
                         ISemaphorePool semaphorePool,
                         CultureInfo currentCulture,
                         CultureInfo defaultCulture,
                         ObjectCache fixtureTimestampCache)
     : base(fixture, dataRouterManager, semaphorePool, currentCulture, defaultCulture, fixtureTimestampCache)
 {
     Merge(fixture, currentCulture, true);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TournamentInfoCI"/> class
 /// </summary>
 /// <param name="eventSummary">The sport event summary</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
 /// <param name="currentCulture">A <see cref="CultureInfo" /> of the <see cref="SportEventSummaryDTO" /> instance</param>
 /// <param name="defaultCulture">A <see cref="CultureInfo" /> specifying the language used when fetching info which is not translatable (e.g. Scheduled, ..)</param>
 /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixture timestamps</param>
 public TournamentInfoCI(TournamentInfoDTO eventSummary,
                         IDataRouterManager dataRouterManager,
                         ISemaphorePool semaphorePool,
                         CultureInfo currentCulture,
                         CultureInfo defaultCulture,
                         MemoryCache fixtureTimestampCache)
     : base(eventSummary, dataRouterManager, semaphorePool, currentCulture, defaultCulture, fixtureTimestampCache)
 {
     Merge(eventSummary, currentCulture, true);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LotteryCI"/> class
 /// </summary>
 /// <param name="exportable">A <see cref="ExportableLotteryCI" /> specifying the current instance</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
 /// <param name="defaultCulture">A <see cref="CultureInfo" /> specifying the language used when fetching info which is not translatable (e.g. Scheduled, ..)</param>
 /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixture timestamps</param>
 public LotteryCI(ExportableLotteryCI exportable,
                  IDataRouterManager dataRouterManager,
                  ISemaphorePool semaphorePool,
                  CultureInfo defaultCulture,
                  MemoryCache fixtureTimestampCache)
     : base(exportable, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
 {
     _categoryId     = URN.Parse(exportable.CategoryId);
     _bonusInfo      = exportable.BonusInfo != null ? new BonusInfoCI(exportable.BonusInfo) : null;
     _drawInfo       = exportable.DrawInfo != null ? new DrawInfoCI(exportable.DrawInfo) : null;
     _scheduledDraws = exportable.ScheduledDraws?.Select(URN.Parse).ToList();
 }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StageCI"/> class
 /// </summary>
 /// <param name="exportable">The exportable cache item</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">The semaphore pool</param>
 /// <param name="defaultCulture">The default culture</param>
 /// <param name="fixtureTimestampCache">A <see cref="ObjectCache"/> used to cache the sport events fixture timestamps</param>
 public StageCI(ExportableStageCI exportable,
                IDataRouterManager dataRouterManager,
                ISemaphorePool semaphorePool,
                CultureInfo defaultCulture,
                ObjectCache fixtureTimestampCache)
     : base(exportable, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
 {
     _categoryId  = URN.Parse(exportable.CategoryId);
     _parentStage = exportable.ParentStage != null ? new StageCI(exportable.ParentStage, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache) : null;
     _childStages = exportable.ChildStages?.Select(s => new StageCI(s, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache));
     _stageType   = exportable.StageType;
 }
Example #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StageCI"/> class
 /// </summary>
 /// <param name="exportable">The exportable cache item</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixtureDTO</param>
 /// <param name="semaphorePool">The semaphore pool</param>
 /// <param name="defaultCulture">The default culture</param>
 /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixtureDTO timestamps</param>
 public StageCI(ExportableStageCI exportable,
                IDataRouterManager dataRouterManager,
                ISemaphorePool semaphorePool,
                CultureInfo defaultCulture,
                MemoryCache fixtureTimestampCache)
     : base(exportable, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
 {
     _categoryId          = string.IsNullOrEmpty(exportable.CategoryId) ? null : URN.Parse(exportable.CategoryId);
     _parentStageId       = string.IsNullOrEmpty(exportable.ParentStageId) ? null : URN.Parse(exportable.ParentStageId);
     _childStages         = exportable.ChildStages?.Select(s => new StageCI(s, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache));
     _additionalParentIds = exportable.AdditionalParentIds.IsNullOrEmpty() ? null : exportable.AdditionalParentIds.Select(URN.Parse).ToList();
 }
Example #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StageCI"/> class
 /// </summary>
 /// <param name="exportable">The exportable cache item</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixtureDTO</param>
 /// <param name="semaphorePool">The semaphore pool</param>
 /// <param name="defaultCulture">The default culture</param>
 /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixtureDTO timestamps</param>
 public StageCI(ExportableStageCI exportable,
                IDataRouterManager dataRouterManager,
                ISemaphorePool semaphorePool,
                CultureInfo defaultCulture,
                MemoryCache fixtureTimestampCache)
     : base(exportable, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
 {
     _categoryId          = URN.Parse(exportable.CategoryId);
     _parentStageId       = exportable.ParentStageId;
     _childStages         = exportable.ChildStages?.Select(s => new StageCI(s, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache));
     _additionalParentIds = exportable.AdditionalParentIds;
 }
Example #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SportEventCacheItemFactory"/> class.
        /// </summary>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
        /// <param name="semaphorePool">A <see cref="ISemaphorePool"/> instance to be used by instances constructed by this factory</param>
        /// <param name="defaultCulture">A <see cref="CultureInfo"/> specifying the default culture of the built cache items</param>
        /// <param name="fixtureTimestampCache">The in-memory cache of sport events fixture timestamps</param>
        public SportEventCacheItemFactory(IDataRouterManager dataRouterManager, ISemaphorePool semaphorePool, CultureInfo defaultCulture, MemoryCache fixtureTimestampCache)
        {
            Guard.Argument(dataRouterManager, nameof(dataRouterManager)).NotNull();
            Guard.Argument(semaphorePool, nameof(semaphorePool)).NotNull();
            Guard.Argument(defaultCulture, nameof(defaultCulture)).NotNull();
            Guard.Argument(fixtureTimestampCache, nameof(fixtureTimestampCache)).NotNull();

            _dataRouterManager     = dataRouterManager;
            _semaphorePool         = semaphorePool;
            _defaultCulture        = defaultCulture;
            _fixtureTimestampCache = fixtureTimestampCache;
        }
Example #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SportEventCacheItemFactory"/> class.
        /// </summary>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
        /// <param name="semaphorePool">A <see cref="ISemaphorePool"/> instance to be used by instances constructed by this factory</param>
        /// <param name="defaultCulture">A <see cref="CultureInfo"/> specifying the default culture of the built cache items</param>
        /// <param name="fixtureTimestampCache">The in-memory cache of sport events fixture timestamps</param>
        public SportEventCacheItemFactory(IDataRouterManager dataRouterManager, ISemaphorePool semaphorePool, CultureInfo defaultCulture, ObjectCache fixtureTimestampCache)
        {
            Contract.Requires(dataRouterManager != null);
            Contract.Requires(semaphorePool != null);
            Contract.Requires(defaultCulture != null);
            Contract.Requires(fixtureTimestampCache != null);

            _dataRouterManager     = dataRouterManager;
            _semaphorePool         = semaphorePool;
            _defaultCulture        = defaultCulture;
            _fixtureTimestampCache = fixtureTimestampCache;
        }
Example #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LotteryCI"/> class
        /// </summary>
        /// <param name="eventSummary">The event summary</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
        /// <param name="semaphorePool">The semaphore pool</param>
        /// <param name="currentCulture">The current culture</param>
        /// <param name="defaultCulture">The default culture</param>
        /// <param name="fixtureTimestampCache">A <see cref="ObjectCache"/> used to cache the sport events fixture timestamps</param>
        public LotteryCI(LotteryDTO eventSummary,
                         IDataRouterManager dataRouterManager,
                         ISemaphorePool semaphorePool,
                         CultureInfo currentCulture,
                         CultureInfo defaultCulture,
                         ObjectCache fixtureTimestampCache)
            : base(eventSummary, dataRouterManager, semaphorePool, currentCulture, defaultCulture, fixtureTimestampCache)
        {
            Guard.Argument(eventSummary, nameof(eventSummary)).NotNull();
            Guard.Argument(currentCulture, nameof(currentCulture)).NotNull();

            Merge(eventSummary, currentCulture);
        }
Example #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SportEventCI" /> class
        /// </summary>
        /// <param name="eventSummary">The sport event summary</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
        /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
        /// <param name="currentCulture">A <see cref="CultureInfo" /> of the <see cref="SportEventSummaryDTO" /> instance</param>
        /// <param name="defaultCulture">A <see cref="CultureInfo" /> specifying the language used when fetching info which is not translatable (e.g. Scheduled, ..)</param>
        /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixture timestamps</param>
        public SportEventCI(SportEventSummaryDTO eventSummary,
                            IDataRouterManager dataRouterManager,
                            ISemaphorePool semaphorePool,
                            CultureInfo currentCulture,
                            CultureInfo defaultCulture,
                            MemoryCache fixtureTimestampCache)
            : this(eventSummary.Id, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
        {
            Guard.Argument(eventSummary, nameof(eventSummary)).NotNull();
            Guard.Argument(currentCulture, nameof(currentCulture)).NotNull();

            Merge(eventSummary, currentCulture);
        }
Example #19
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="SportEventCI" /> class
        /// </summary>
        /// <param name="eventSummary">The sport event summary</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager" /> used to obtain summary and fixture</param>
        /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
        /// <param name="currentCulture">A <see cref="CultureInfo" /> of the <see cref="SportEventSummaryDTO" /> instance</param>
        /// <param name="defaultCulture">
        ///     A <see cref="CultureInfo" /> specifying the language used when fetching info which is not
        ///     translatable (e.g. Scheduled, ..)
        /// </param>
        /// <param name="fixtureTimestampCache">A <see cref="MemoryCache" /> used to cache the sport events fixture timestamps</param>
        public SportEventCI(SportEventSummaryDTO eventSummary,
                            IDataRouterManager dataRouterManager,
                            ISemaphorePool semaphorePool,
                            CultureInfo currentCulture,
                            CultureInfo defaultCulture,
                            MemoryCache fixtureTimestampCache)
            : this(eventSummary.Id, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
        {
            Contract.Requires(eventSummary != null);
            Contract.Requires(currentCulture != null);

            Merge(eventSummary, currentCulture);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompetitionCI"/> class
        /// </summary>
        /// <param name="eventSummary">The event summary</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
        /// <param name="semaphorePool">The semaphore pool</param>
        /// <param name="currentCulture">The current culture</param>
        /// <param name="defaultCulture">The default culture</param>
        /// <param name="fixtureTimestampCache">A <see cref="ObjectCache"/> used to cache the sport events fixture timestamps</param>
        public CompetitionCI(CompetitionDTO eventSummary,
                             IDataRouterManager dataRouterManager,
                             ISemaphorePool semaphorePool,
                             CultureInfo currentCulture,
                             CultureInfo defaultCulture,
                             ObjectCache fixtureTimestampCache)
            : base(eventSummary, dataRouterManager, semaphorePool, currentCulture, defaultCulture, fixtureTimestampCache)
        {
            Contract.Requires(eventSummary != null);
            Contract.Requires(currentCulture != null);

            Merge(eventSummary, currentCulture, true);
        }
Example #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CompetitionCI"/> class
        /// </summary>
        /// <param name="eventSummary">The event summary</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixtureDTO</param>
        /// <param name="semaphorePool">The semaphore pool</param>
        /// <param name="currentCulture">The current culture</param>
        /// <param name="defaultCulture">The default culture</param>
        /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixtureDTO timestamps</param>
        public CompetitionCI(CompetitionDTO eventSummary,
                             IDataRouterManager dataRouterManager,
                             ISemaphorePool semaphorePool,
                             CultureInfo currentCulture,
                             CultureInfo defaultCulture,
                             MemoryCache fixtureTimestampCache)
            : base(eventSummary, dataRouterManager, semaphorePool, currentCulture, defaultCulture, fixtureTimestampCache)
        {
            Guard.Argument(eventSummary, nameof(eventSummary)).NotNull();
            Guard.Argument(currentCulture, nameof(currentCulture)).NotNull();

            Merge(eventSummary, currentCulture, true);
        }
Example #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DrawCI"/> class
 /// </summary>
 /// <param name="exportable">A <see cref="ExportableDrawCI" /> specifying the current instance</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
 /// <param name="defaultCulture">A <see cref="CultureInfo" /> specifying the language used when fetching info which is not translatable (e.g. Scheduled, ..)</param>
 /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixture timestamps</param>
 public DrawCI(ExportableDrawCI exportable,
               IDataRouterManager dataRouterManager,
               ISemaphorePool semaphorePool,
               CultureInfo defaultCulture,
               MemoryCache fixtureTimestampCache)
     : base(exportable, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
 {
     _lotteryId            = URN.Parse(exportable.LotteryId);
     _drawStatus           = exportable.DrawStatus;
     _resultsChronological = exportable.ResultsChronological;
     _results   = exportable.Results?.Select(r => new DrawResultCI(r)).ToList();
     _displayId = exportable.DisplayId;
 }
Example #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MatchCI"/> class
 /// </summary>
 /// <param name="exportable">A <see cref="ExportableMatchCI" /> specifying the current instance</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
 /// <param name="defaultCulture">A <see cref="CultureInfo" /> specifying the language used when fetching info which is not translatable (e.g. Scheduled, ..)</param>
 /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixture timestamps</param>
 public MatchCI(ExportableMatchCI exportable,
     IDataRouterManager dataRouterManager,
     ISemaphorePool semaphorePool,
     CultureInfo defaultCulture,
     MemoryCache fixtureTimestampCache)
     : base(exportable, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
 {
     _season = exportable.Season != null ? new CacheItem(exportable.Season) : null;
     _tournamentRound = exportable.TournamentRound != null ? new RoundCI(exportable.TournamentRound) : null;
     _tournamentId = exportable.TournamentId != null ? URN.Parse(exportable.TournamentId) : null;
     _fixture = exportable.Fixture != null ? new Fixture(exportable.Fixture) : null;
     _eventTimeline = exportable.EventTimeline != null ? new EventTimelineCI(exportable.EventTimeline) : null;
     _delayedInfo = exportable.DelayedInfo != null ? new DelayedInfoCI(exportable.DelayedInfo) : null;
 }
Example #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SportEventCI" /> class
        /// </summary>
        /// <param name="exportable">A <see cref="ExportableSportEventCI" /> representing the sport event</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
        /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
        /// <param name="defaultCulture">A <see cref="CultureInfo" /> specifying the language used when fetching info which is not translatable (e.g. Scheduled, ..)</param>
        /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixture timestamps</param>
        public SportEventCI(ExportableSportEventCI exportable,
                            IDataRouterManager dataRouterManager,
                            ISemaphorePool semaphorePool,
                            CultureInfo defaultCulture,
                            MemoryCache fixtureTimestampCache)
            : this(URN.Parse(exportable.Id), dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
        {
            Names         = new Dictionary <CultureInfo, string>(exportable.Name);
            _sportId      = _sportId = exportable.SportId == null ? null : URN.Parse(exportable.SportId);
            Scheduled     = exportable.Scheduled;
            ScheduledEnd  = exportable.ScheduledEnd;
            _startTimeTbd = exportable.StartTimeTbd;
            _replacedBy   = exportable.ReplacedBy != null?URN.Parse(exportable.ReplacedBy) : null;

            LoadedFixtures  = new List <CultureInfo>(exportable.LoadedFixtures ?? new List <CultureInfo>());
            LoadedSummaries = new List <CultureInfo>(exportable.LoadedSummaries ?? new List <CultureInfo>());
        }
Example #25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SportEventCI" /> class
        /// </summary>
        /// <param name="id">A <see cref="URN" /> specifying the id of the sport event associated with the current instance</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
        /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
        /// <param name="defaultCulture">A <see cref="CultureInfo" /> specifying the language used when fetching info which is not translatable (e.g. Scheduled, ..)</param>
        /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixture timestamps</param>
        public SportEventCI(URN id,
                            IDataRouterManager dataRouterManager,
                            ISemaphorePool semaphorePool,
                            CultureInfo defaultCulture,
                            MemoryCache fixtureTimestampCache)
        {
            Guard.Argument(id, nameof(id)).NotNull();
            Guard.Argument(dataRouterManager, nameof(dataRouterManager)).NotNull();
            Guard.Argument(defaultCulture, nameof(defaultCulture)).NotNull();
            Guard.Argument(semaphorePool, nameof(semaphorePool)).NotNull();
            Guard.Argument(fixtureTimestampCache, nameof(fixtureTimestampCache)).NotNull();

            Id = id;
            DataRouterManager     = dataRouterManager;
            SemaphorePool         = semaphorePool;
            DefaultCulture        = defaultCulture;
            FixtureTimestampCache = fixtureTimestampCache;
        }
Example #26
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="SportEventCI" /> class
        /// </summary>
        /// <param name="id">A <see cref="URN" /> specifying the id of the sport event associated with the current instance</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager" /> used to obtain summary and fixture</param>
        /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
        /// <param name="defaultCulture">
        ///     A <see cref="CultureInfo" /> specifying the language used when fetching info which is not
        ///     translatable (e.g. Scheduled, ..)
        /// </param>
        /// <param name="fixtureTimestampCache">A <see cref="MemoryCache" /> used to cache the sport events fixture timestamps</param>
        public SportEventCI(URN id,
                            IDataRouterManager dataRouterManager,
                            ISemaphorePool semaphorePool,
                            CultureInfo defaultCulture,
                            MemoryCache fixtureTimestampCache)
        {
            Contract.Requires(id != null);
            Contract.Requires(dataRouterManager != null);
            Contract.Requires(defaultCulture != null);
            Contract.Requires(semaphorePool != null);
            Contract.Requires(fixtureTimestampCache != null);

            Id = id;
            DataRouterManager     = dataRouterManager;
            SemaphorePool         = semaphorePool;
            DefaultCulture        = defaultCulture;
            FixtureTimestampCache = fixtureTimestampCache;
        }
Example #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CompetitionCI" /> class
        /// </summary>
        /// <param name="exportable">A <see cref="ExportableSportEventCI" /> representing the sport event</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
        /// <param name="semaphorePool">A <see cref="ISemaphorePool" /> instance used to obtain sync objects</param>
        /// <param name="defaultCulture">A <see cref="CultureInfo" /> specifying the language used when fetching info which is not translatable (e.g. Scheduled, ..)</param>
        /// <param name="fixtureTimestampCache">A <see cref="ObjectCache"/> used to cache the sport events fixture timestamps</param>
        public CompetitionCI(ExportableSportEventCI exportable,
                             IDataRouterManager dataRouterManager,
                             ISemaphorePool semaphorePool,
                             CultureInfo defaultCulture,
                             ObjectCache fixtureTimestampCache)
            : base(exportable, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
        {
            var exportableCompetition = exportable as ExportableCompetitionCI;

            if (exportableCompetition != null)
            {
                _bookingStatus = exportableCompetition.BookingStatus;
                _venue         = exportableCompetition.Venue != null ? new VenueCI(exportableCompetition.Venue) : null;
                _conditions    = exportableCompetition.Conditions != null
                    ? new SportEventConditionsCI(exportableCompetition.Conditions)
                    : null;
                Competitors = exportableCompetition.Competitors != null
                    ? new List <URN>(exportableCompetition.Competitors.Select(URN.Parse))
                    : null;
                _referenceId = exportableCompetition.ReferenceId != null
                    ? new ReferenceIdCI(exportableCompetition.ReferenceId)
                    : null;
                _competitorsQualifiers = exportableCompetition.CompetitorsQualifiers != null
                    ? new Dictionary <URN, string>(
                    exportableCompetition.CompetitorsQualifiers.ToDictionary(c => URN.Parse(c.Key), c => c.Value))
                    : null;
                _competitorsReferences = exportableCompetition.CompetitorsReferences != null
                    ? new Dictionary <URN, ReferenceIdCI>(
                    exportableCompetition.CompetitorsReferences.ToDictionary(c => URN.Parse(c.Key),
                                                                             c => new ReferenceIdCI(c.Value)))
                    : null;
                _competitorsVirtual = exportableCompetition.CompetitorsVirtual != null
                                          ? exportableCompetition.CompetitorsVirtual.Select(URN.Parse).ToList()
                                          : new List <URN>();

                _liveOdds       = string.IsNullOrEmpty(exportableCompetition.LiveOdds) ? null : exportableCompetition.LiveOdds;
                _sportEventType = exportableCompetition.SportEventType;
                _stageType      = exportableCompetition.StageType;
            }
        }