/// <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; }
/// <summary> /// Initializes a new instance of the <see cref="MarketDescriptionManager"/> class /// </summary> /// <param name="config">The <see cref="IOddsFeedConfigurationInternal"/> representing feed configuration</param> /// <param name="marketCacheProvider">A <see cref="IMarketCacheProvider"/> used to get market descriptions</param> /// <param name="invariantMarketDescriptionCache">A <see cref="IMarketDescriptionCache"/> used to get invariant market descriptions</param> /// <param name="variantDescriptionListCache">A <see cref="IVariantDescriptionCache"/> used to reload variant market descriptions</param> /// <param name="variantDescriptionCache">A <see cref="IMarketDescriptionCache"/> used to access market variant cache (singles)</param> public MarketDescriptionManager(IOddsFeedConfigurationInternal config, IMarketCacheProvider marketCacheProvider, IMarketDescriptionCache invariantMarketDescriptionCache, IVariantDescriptionCache variantDescriptionListCache, IMarketDescriptionCache variantDescriptionCache) { if (config == null) { throw new ArgumentNullException(nameof(config)); } if (marketCacheProvider == null) { throw new ArgumentNullException(nameof(marketCacheProvider)); } if (invariantMarketDescriptionCache == null) { throw new ArgumentNullException(nameof(invariantMarketDescriptionCache)); } if (variantDescriptionCache == null) { throw new ArgumentNullException(nameof(variantDescriptionCache)); } _config = config; _marketCacheProvider = marketCacheProvider; _invariantMarketDescriptionCache = invariantMarketDescriptionCache as InvariantMarketDescriptionCache; _variantDescriptionListCache = variantDescriptionListCache; _exceptionHandlingStrategy = config.ExceptionHandlingStrategy; _variantDescriptionCache = variantDescriptionCache; if (_invariantMarketDescriptionCache == null) { throw new ArgumentException(nameof(invariantMarketDescriptionCache)); } }
/// <summary> /// Initializes a new instance of the <see cref="NameProvider"/> class /// </summary> /// <param name="marketCacheProvider">A <see cref="IMarketCacheProvider"/> instance used to retrieve market descriptors</param> /// <param name="eventStatusCache">A <see cref="ISportEventStatusCache"/> instance used to retrieve event status data</param> /// <param name="sportEvent">A <see cref="ISportEvent"/> instance representing associated sport @event</param> /// <param name="marketId">A market identifier of the market associated with the constructed instance</param> /// <param name="specifiers">A <see cref="IReadOnlyDictionary{String, String}"/> representing specifiers of the associated market</param> /// <param name="producer">An <see cref="IProducer"/> used to get market/outcome mappings</param> /// <param name="sportId">A sportId used to get market/outcome mappings</param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> describing the mode in which the SDK is running</param> /// <param name="producerManager">The <see cref="IProducerManager"/> used get available <see cref="IProducer"/></param> internal MarketMappingProvider(IMarketCacheProvider marketCacheProvider, ISportEventStatusCache eventStatusCache, ISportEvent sportEvent, int marketId, IReadOnlyDictionary <string, string> specifiers, IProducer producer, URN sportId, ExceptionHandlingStrategy exceptionStrategy, IProducerManager producerManager) { Contract.Requires(marketCacheProvider != null); Contract.Requires(sportEvent != null); Contract.Requires(eventStatusCache != null); Contract.Requires(producerManager != null); _marketCacheProvider = marketCacheProvider; _eventStatusCache = eventStatusCache; _sportEvent = sportEvent; _marketId = marketId; _specifiers = specifiers; _exceptionStrategy = exceptionStrategy; _producerManager = producerManager; _producer = producer; _sportId = sportId; }
/// <summary> /// Initializes a new instance of the <see cref="NameProvider"/> class /// </summary> /// <param name="marketCacheProvider">A <see cref="IMarketCacheProvider"/> instance used to retrieve market descriptors</param> /// <param name="eventStatusCache">A <see cref="ISportEventStatusCache"/> instance used to retrieve event status data</param> /// <param name="sportEvent">A <see cref="ISportEvent"/> instance representing associated sport @event</param> /// <param name="marketId">A market identifier of the market associated with the constructed instance</param> /// <param name="specifiers">A <see cref="IReadOnlyDictionary{String, String}"/> representing specifiers of the associated market</param> /// <param name="producer">An <see cref="IProducer"/> used to get market/outcome mappings</param> /// <param name="sportId">A sportId used to get market/outcome mappings</param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> describing the mode in which the SDK is running</param> /// <param name="producerManager">The <see cref="IProducerManager"/> used get available <see cref="IProducer"/></param> internal MarketMappingProvider(IMarketCacheProvider marketCacheProvider, ISportEventStatusCache eventStatusCache, ISportEvent sportEvent, int marketId, IReadOnlyDictionary <string, string> specifiers, IProducer producer, URN sportId, ExceptionHandlingStrategy exceptionStrategy, IProducerManager producerManager) { Guard.Argument(marketCacheProvider, nameof(marketCacheProvider)).NotNull(); Guard.Argument(sportEvent, nameof(sportEvent)).NotNull(); Guard.Argument(eventStatusCache, nameof(eventStatusCache)).NotNull(); Guard.Argument(producerManager, nameof(producerManager)).NotNull(); _marketCacheProvider = marketCacheProvider; _eventStatusCache = eventStatusCache; _sportEvent = sportEvent; _marketId = marketId; _specifiers = specifiers; _exceptionStrategy = exceptionStrategy; _producerManager = producerManager; _producer = producer; _sportId = sportId; }
/// <summary> /// Constructs a new market definition. The market definition represents additional market data which can be used for more advanced use cases /// </summary> /// <param name="marketDescription">The associated market descriptor</param> /// <param name="marketCacheProvider">The market cache provider used to retrieve name templates</param> /// <param name="sportId">The associated event sport identifier</param> /// <param name="producer">The producer which generated the market</param> /// <param name="specifiers">The associated market specifiers</param> internal MarketDefinition(IMarketDescription marketDescription, IMarketCacheProvider marketCacheProvider, URN sportId, IProducer producer, IReadOnlyDictionary <string, string> specifiers) { _marketDescription = marketDescription; _sportId = sportId; _producer = producer; _specifiers = specifiers; _marketCacheProvider = marketCacheProvider; }
/// <summary> /// Initializes a new instance of the <see cref="NameProviderFactory"/> class. /// </summary> /// <param name="marketCacheProvider">A <see cref="IMarketCacheProvider"/> instance used to retrieve market descriptors</param> /// <param name="eventStatusCache">A <see cref="ISportEventStatusCache"/> instance used to retrieve event status data</param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> specifying how to handle potential exceptions thrown to the user code</param> public MarketMappingProviderFactory(IMarketCacheProvider marketCacheProvider, ISportEventStatusCache eventStatusCache, ExceptionHandlingStrategy exceptionStrategy) { Guard.Argument(marketCacheProvider, nameof(marketCacheProvider)).NotNull(); Guard.Argument(eventStatusCache, nameof(eventStatusCache)).NotNull(); _marketCacheProvider = marketCacheProvider; _eventStatusCache = eventStatusCache; _exceptionStrategy = exceptionStrategy; }
/// <summary> /// Initializes a new instance of the <see cref="NameProviderFactory"/> class. /// </summary> /// <param name="marketCacheProvider">A <see cref="IMarketCacheProvider"/> instance used to retrieve market descriptors</param> /// <param name="profileCache">A <see cref="IProfileCache"/> instance used to retrieve player and competitor profiles</param> /// <param name="expressionFactory">A <see cref="INameExpressionFactory"/> instance used to built <see cref="INameExpression"/> instances</param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> specifying how to handle potential exceptions thrown to the user code</param> public NameProviderFactory(IMarketCacheProvider marketCacheProvider, IProfileCache profileCache, INameExpressionFactory expressionFactory, ExceptionHandlingStrategy exceptionStrategy) { Contract.Requires(marketCacheProvider != null); Contract.Requires(profileCache != null); Contract.Requires(expressionFactory != null); _marketCacheProvider = marketCacheProvider; _profileCache = profileCache; _expressionFactory = expressionFactory; _exceptionStrategy = exceptionStrategy; }
/// <summary> /// Initializes a new instance of the <see cref="NameProviderFactory"/> class. /// </summary> /// <param name="marketCacheProvider">A <see cref="IMarketCacheProvider"/> instance used to retrieve market descriptors</param> /// <param name="profileCache">A <see cref="IProfileCache"/> instance used to retrieve player and competitor profiles</param> /// <param name="expressionFactory">A <see cref="INameExpressionFactory"/> instance used to built <see cref="INameExpression"/> instances</param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> specifying how to handle potential exceptions thrown to the user code</param> public NameProviderFactory(IMarketCacheProvider marketCacheProvider, IProfileCache profileCache, INameExpressionFactory expressionFactory, ExceptionHandlingStrategy exceptionStrategy) { Guard.Argument(marketCacheProvider, nameof(marketCacheProvider)).NotNull(); Guard.Argument(profileCache, nameof(profileCache)).NotNull(); Guard.Argument(expressionFactory, nameof(expressionFactory)).NotNull(); _marketCacheProvider = marketCacheProvider; _profileCache = profileCache; _expressionFactory = expressionFactory; _exceptionStrategy = exceptionStrategy; }
/// <summary> /// Initializes a new instance of the <see cref="NameProviderFactory"/> class. /// </summary> /// <param name="marketCacheProvider">A <see cref="IMarketCacheProvider"/> instance used to retrieve market descriptors</param> /// <param name="eventStatusCache">A <see cref="ISportEventStatusCache"/> instance used to retrieve event status data</param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> specifying how to handle potential exceptions thrown to the user code</param> /// <param name="producerManager">An <see cref="IProducerManager"/> used to get <see cref="IProducer"/></param> public MarketMappingProviderFactory(IMarketCacheProvider marketCacheProvider, ISportEventStatusCache eventStatusCache, ExceptionHandlingStrategy exceptionStrategy, IProducerManager producerManager) { Contract.Requires(marketCacheProvider != null); Contract.Requires(eventStatusCache != null); Contract.Requires(producerManager != null); _marketCacheProvider = marketCacheProvider; _eventStatusCache = eventStatusCache; _exceptionStrategy = exceptionStrategy; _producerManager = producerManager; }
/// <summary> /// Initializes a new instance of the <see cref="IFeedMessageValidator"/> class /// </summary> /// <param name="marketCacheProvider">The <see cref="IMarketCacheProvider"/> used to get <see cref="IMarketDescription"/></param> /// <param name="defaultCulture">The default culture used to retrieve <see cref="IMarketDescription"/></param> /// <param name="namedValuesProvider">A <see cref="INamedValuesProvider"/> used to provide descriptions for named values</param> /// <param name="producerManager">A <see cref="IProducerManager"/> used to check available producers</param> public FeedMessageValidator(IMarketCacheProvider marketCacheProvider, CultureInfo defaultCulture, INamedValuesProvider namedValuesProvider, IProducerManager producerManager) { Contract.Requires(marketCacheProvider != null); Contract.Requires(defaultCulture != null); Contract.Requires(namedValuesProvider != null); Contract.Requires(producerManager != null); _marketCacheProvider = marketCacheProvider; _defaultCulture = new List <CultureInfo> { defaultCulture }; _namedValuesProvider = namedValuesProvider; _producerManager = producerManager; }
/// <summary> /// Initializes a new instance of the <see cref="IFeedMessageValidator"/> class /// </summary> /// <param name="marketCacheProvider">The <see cref="IMarketCacheProvider"/> used to get <see cref="IMarketDescription"/></param> /// <param name="defaultCulture">The default culture used to retrieve <see cref="IMarketDescription"/></param> /// <param name="namedValuesProvider">A <see cref="INamedValuesProvider"/> used to provide descriptions for named values</param> /// <param name="producerManager">A <see cref="IProducerManager"/> used to check available producers</param> public FeedMessageValidator(IMarketCacheProvider marketCacheProvider, CultureInfo defaultCulture, INamedValuesProvider namedValuesProvider, IProducerManager producerManager) { Guard.Argument(marketCacheProvider, nameof(marketCacheProvider)).NotNull(); Guard.Argument(defaultCulture, nameof(defaultCulture)).NotNull(); Guard.Argument(namedValuesProvider, nameof(namedValuesProvider)).NotNull(); Guard.Argument(producerManager, nameof(producerManager)).NotNull(); _marketCacheProvider = marketCacheProvider; _defaultCulture = new List <CultureInfo> { defaultCulture }; _namedValuesProvider = namedValuesProvider; _producerManager = producerManager; }
/// <summary> /// Constructs a new market definition. The market definition represents additional market data which can be used for more advanced use cases /// </summary> /// <param name="marketId">The id of the market</param> /// <param name="marketCacheProvider">The market cache provider used to retrieve name templates</param> /// <param name="sportId">The associated event sport identifier</param> /// <param name="producerId">The producer of the producer which generated the market</param> /// <param name="specifiers">The associated market specifiers</param> /// <param name="cultures">The cultures</param> /// <param name="exceptionHandlingStrategy">The exception handling strategy</param> internal MarketDefinition(int marketId, IMarketCacheProvider marketCacheProvider, URN sportId, int producerId, IReadOnlyDictionary <string, string> specifiers, IEnumerable <CultureInfo> cultures, ExceptionHandlingStrategy exceptionHandlingStrategy) { _marketId = marketId; _sportId = sportId; _producerId = producerId; _specifiers = specifiers; _cultures = cultures; _exceptionHandlingStrategy = exceptionHandlingStrategy; _marketCacheProvider = marketCacheProvider; }
internal OutcomeDefinition(IMarketDescription marketDescription, string outcomeId, IMarketCacheProvider marketCacheProvider, IReadOnlyDictionary <string, string> specifiers, IEnumerable <CultureInfo> cultures, ExceptionHandlingStrategy exceptionHandlingStrategy) { Guard.Argument(cultures, nameof(cultures)).NotNull(); _marketDescription = marketDescription; _marketCacheProvider = marketCacheProvider; _outcomeId = outcomeId; _specifiers = specifiers; _cultures = cultures as IReadOnlyCollection <CultureInfo>; _exceptionHandlingStrategy = exceptionHandlingStrategy; }
public void Init() { _variantMarketDescriptionMemoryCache = new MemoryCache("variantMarketDescriptionCache"); _variantDescriptionMemoryCache = new MemoryCache("variantDescriptionCache"); _invariantMarketDescriptionMemoryCache = new MemoryCache("invariantMarketDescriptionCache"); _cacheManager = new CacheManager(); _dataRouterManager = new TestDataRouterManager(_cacheManager); _producersProvider = new TestProducersProvider(); _mappingValidatorFactory = new MappingValidatorFactory(); _timer = new TestTimer(true); _variantMarketDescriptionCache = new VariantMarketDescriptionCache(_variantMarketDescriptionMemoryCache, _dataRouterManager, _mappingValidatorFactory, _cacheManager); _variantDescriptionListCache = new VariantDescriptionListCache(_variantDescriptionMemoryCache, _dataRouterManager, _mappingValidatorFactory, _timer, TestData.Cultures, _cacheManager); _invariantMarketDescriptionCache = new InvariantMarketDescriptionCache(_invariantMarketDescriptionMemoryCache, _dataRouterManager, _mappingValidatorFactory, _timer, TestData.Cultures, _cacheManager); _marketCacheProvider = new MarketCacheProvider(_invariantMarketDescriptionCache, _variantMarketDescriptionCache, _variantDescriptionListCache); }
/// <summary> /// Initializes a new instance of the <see cref="NameProvider"/> class /// </summary> /// <param name="marketCacheProvider">A <see cref="IMarketCacheProvider"/> instance used to retrieve market descriptors</param> /// <param name="profileCache">A <see cref="IProfileCache"/> instance used to retrieve player and competitor profiles</param> /// <param name="expressionFactory">A <see cref="INameExpressionFactory"/> instance used to built <see cref="INameExpression"/> instances</param> /// <param name="sportEvent">A <see cref="ISportEvent"/> instance representing associated sport @event</param> /// <param name="marketId">A market identifier of the market associated with the constructed instance</param> /// <param name="specifiers">A <see cref="IReadOnlyDictionary{String, String}"/> representing specifiers of the associated market</param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> describing the mode in which the SDK is running</param> internal NameProvider( IMarketCacheProvider marketCacheProvider, IProfileCache profileCache, INameExpressionFactory expressionFactory, ISportEvent sportEvent, int marketId, IReadOnlyDictionary <string, string> specifiers, ExceptionHandlingStrategy exceptionStrategy) { Guard.Argument(marketCacheProvider, nameof(marketCacheProvider)).NotNull(); Guard.Argument(profileCache, nameof(profileCache)).NotNull(); Guard.Argument(expressionFactory, nameof(expressionFactory)).NotNull(); Guard.Argument(sportEvent, nameof(sportEvent)).NotNull(); _marketCacheProvider = marketCacheProvider; _profileCache = profileCache; _expressionFactory = expressionFactory; _sportEvent = sportEvent; _marketId = marketId; _specifiers = specifiers; _exceptionStrategy = exceptionStrategy; _competitorsAlreadyFetched = false; }
/// <summary> /// Initializes a new instance of the <see cref="NameProvider"/> class /// </summary> /// <param name="marketCacheProvider">A <see cref="IMarketCacheProvider"/> instance used to retrieve market descriptors</param> /// <param name="profileCache">A <see cref="IProfileCache"/> instance used to retrieve player and competitor profiles</param> /// <param name="expressionFactory">A <see cref="INameExpressionFactory"/> instance used to built <see cref="INameExpression"/> instances</param> /// <param name="sportEvent">A <see cref="ISportEvent"/> instance representing associated sport @event</param> /// <param name="marketId">A market identifier of the market associated with the constructed instance</param> /// <param name="specifiers">A <see cref="IReadOnlyDictionary{String, String}"/> representing specifiers of the associated market</param> /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> describing the mode in which the SDK is running</param> internal NameProvider( IMarketCacheProvider marketCacheProvider, IProfileCache profileCache, INameExpressionFactory expressionFactory, ISportEvent sportEvent, int marketId, IReadOnlyDictionary <string, string> specifiers, ExceptionHandlingStrategy exceptionStrategy) { Contract.Requires(marketCacheProvider != null); Contract.Requires(profileCache != null); Contract.Requires(expressionFactory != null); Contract.Requires(sportEvent != null); _marketCacheProvider = marketCacheProvider; _profileCache = profileCache; _expressionFactory = expressionFactory; _sportEvent = sportEvent; _marketId = marketId; _specifiers = specifiers; _exceptionStrategy = exceptionStrategy; _competitorsAlreadyFetched = false; }