/// <summary>
        /// Initializes a new instance of the <see cref="MarketMapping"/> class
        /// </summary>
        /// <param name="cacheItem">A <see cref="MarketMappingCacheItem"/> containing mapping info</param>
        internal MarketMapping(MarketMappingCacheItem cacheItem)
        {
            Guard.Argument(cacheItem, nameof(cacheItem)).NotNull();

            ProducerIds     = cacheItem.ProducerIds;
            SportId         = cacheItem.SportId;
            MarketTypeId    = cacheItem.MarketTypeId;
            MarketSubTypeId = cacheItem.MarketSubTypeId;
            MarketId        = string.IsNullOrEmpty(cacheItem.OrgMarketId)
                           ? MarketSubTypeId == null
                                 ? MarketTypeId.ToString()
                                 : $"{MarketTypeId}:{MarketSubTypeId}"
                           : cacheItem.OrgMarketId;

            SovTemplate     = cacheItem.SovTemplate;
            ValidFor        = cacheItem.ValidFor;
            OutcomeMappings = cacheItem.OutcomeMappings?.Select(o => new OutcomeMapping(o));

            _validator = cacheItem.Validator;
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MarketMapping"/> class
        /// </summary>
        /// <param name="cacheItem">A <see cref="MarketMappingCacheItem"/> containing mapping info</param>
        internal MarketMapping(MarketMappingCacheItem cacheItem)
        {
            Contract.Requires(cacheItem != null);

            ProducerId      = cacheItem.ProducerId;
            ProducerIds     = cacheItem.ProducerIds;
            SportId         = cacheItem.SportId;
            MarketTypeId    = cacheItem.MarketTypeId;
            MarketSubTypeId = cacheItem.MarketSubTypeId;
            MarketId        = string.IsNullOrEmpty(cacheItem.OrgMarketId)
                           ? MarketSubTypeId == null
                                 ? MarketTypeId.ToString()
                                 : $"{MarketTypeId}:{MarketSubTypeId}"
                           : cacheItem.OrgMarketId;

            SovTemplate     = cacheItem.SovTemplate;
            ValidFor        = cacheItem.ValidFor;
            OutcomeMappings = cacheItem.OutcomeMappings?.Select(o => new OutcomeMapping(o));

            _validator = cacheItem.Validator;
        }