示例#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;
            }
        }
示例#2
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>());
        }
示例#3
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;
            }
        }