/// <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="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="NamedValuesProvider"/> class. /// </summary> /// <param name="voidReasons">The <see cref="INamedValueCache" /> providing void reason descriptions.</param> /// <param name="betStopReasons">The <see cref="INamedValueCache" /> providing bet stop reason descriptions.</param> /// <param name="bettingStatuses">The <see cref="INamedValueCache" /> providing betting status descriptions.</param> /// <param name="matchStatuses">The <see cref="ILocalizedNamedValueCache" /> providing localized(translatable) match status descriptions.</param> public NamedValuesProvider(INamedValueCache voidReasons, INamedValueCache betStopReasons, INamedValueCache bettingStatuses, ILocalizedNamedValueCache matchStatuses) { Contract.Requires(voidReasons != null); Contract.Requires(betStopReasons != null); Contract.Requires(bettingStatuses != null); Contract.Requires(matchStatuses != null); VoidReasons = voidReasons; BetStopReasons = betStopReasons; BettingStatuses = bettingStatuses; MatchStatuses = matchStatuses; }
/// <summary> /// Initializes a new instance of the <see cref="NamedValuesProvider"/> class. /// </summary> /// <param name="voidReasons">The <see cref="INamedValueCache" /> providing void reason descriptions.</param> /// <param name="betStopReasons">The <see cref="INamedValueCache" /> providing bet stop reason descriptions.</param> /// <param name="bettingStatuses">The <see cref="INamedValueCache" /> providing betting status descriptions.</param> /// <param name="matchStatuses">The <see cref="ILocalizedNamedValueCache" /> providing localized(translatable) match status descriptions.</param> public NamedValuesProvider(INamedValueCache voidReasons, INamedValueCache betStopReasons, INamedValueCache bettingStatuses, ILocalizedNamedValueCache matchStatuses) { Guard.Argument(voidReasons, nameof(voidReasons)).NotNull(); Guard.Argument(betStopReasons, nameof(betStopReasons)).NotNull(); Guard.Argument(bettingStatuses, nameof(bettingStatuses)).NotNull(); Guard.Argument(matchStatuses, nameof(matchStatuses)).NotNull(); VoidReasons = voidReasons; BetStopReasons = betStopReasons; BettingStatuses = bettingStatuses; MatchStatuses = matchStatuses; }
/// <summary> /// Initializes a new instance of the <see cref="MarketWithSettlement" /> class /// </summary> /// <param name="id">a <see cref="int" /> value specifying the market type</param> /// <param name="specifiers">a <see cref="IReadOnlyDictionary{String, String}" /> containing additional market specifiers</param> /// <param name="additionalInfo">a <see cref="IReadOnlyDictionary{String, String}"/> containing additional market info</param> /// <param name="nameProvider">A <see cref="INameProvider"/> instance used to generate the market name(s)</param> /// <param name="mappingProvider">A <see cref="IMarketMappingProvider"/> instance used for providing mapped ids of markets and outcomes</param> /// <param name="marketDefinition">The associated market definition</param> /// <param name="voidReason">A value specifying the void reason or a null reference</param> /// <param name="voidReasonsCache">A <see cref="INamedValueCache"/> used to get void reason descriptions</param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying languages the current instance supports</param> internal MarketCancel(int id, IReadOnlyDictionary <string, string> specifiers, IReadOnlyDictionary <string, string> additionalInfo, INameProvider nameProvider, IMarketMappingProvider mappingProvider, IMarketDefinition marketDefinition, int?voidReason, INamedValueCache voidReasonsCache, IEnumerable <CultureInfo> cultures) : base(id, specifiers, additionalInfo, nameProvider, mappingProvider, marketDefinition, cultures) { Contract.Requires(voidReasonsCache != null); _voidReason = voidReason; _voidReasonsCache = voidReasonsCache; }
/// <summary> /// Initializes a new instance of the <see cref="MarketWithSettlement" /> class /// </summary> /// <param name="id">a <see cref="int" /> value specifying the market type</param> /// <param name="specifiers">a <see cref="IReadOnlyDictionary{String, String}" /> containing additional market specifiers</param> /// <param name="additionalInfo">a <see cref="IReadOnlyDictionary{String, String}"/> containing additional market info</param> /// <param name="nameProvider">A <see cref="INameProvider"/> instance used to generate the market name(s)</param> /// <param name="mappingProvider">A <see cref="IMarketMappingProvider"/> instance used for providing mapped ids of markets and outcomes</param> /// <param name="marketDefinition">The associated market definition</param> /// <param name="voidReason">A value specifying the void reason or a null reference</param> /// <param name="voidReasonsCache">A <see cref="INamedValueCache"/> used to get void reason descriptions</param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying languages the current instance supports</param> internal MarketCancel(int id, IReadOnlyDictionary <string, string> specifiers, IReadOnlyDictionary <string, string> additionalInfo, INameProvider nameProvider, IMarketMappingProvider mappingProvider, IMarketDefinition marketDefinition, int?voidReason, INamedValueCache voidReasonsCache, IEnumerable <CultureInfo> cultures) : base(id, specifiers, additionalInfo, nameProvider, mappingProvider, marketDefinition, cultures) { Guard.Argument(voidReasonsCache, nameof(voidReasonsCache)).NotNull(); _voidReason = voidReason; _voidReasonsCache = voidReasonsCache; }
/// <summary> /// Initializes a new instance of the <see cref="MarketWithSettlement" /> class /// </summary> /// <param name="id">a <see cref="int" /> value specifying the market type</param> /// <param name="specifiers">a <see cref="IReadOnlyDictionary{String, String}" /> containing additional market specifiers</param> /// <param name="additionalInfo">a <see cref="IReadOnlyDictionary{String, String}"/> containing additional market info</param> /// <param name="outcomes">An <see cref="IEnumerable{IOutcomeSettlement}" /> where each <see cref="IOutcomeSettlement" /> instance providing outcome settling information /// </param> /// <param name="nameProvider">A <see cref="INameProvider"/> instance used to generate the market name(s)</param> /// <param name="mappingProvider">A <see cref="IMarketMappingProvider"/> instance used for providing mapped ids of markets and outcomes</param> /// <param name="marketDefinition">The associated market definition</param> /// <param name="voidReason">A value specifying the void reason or a null reference</param> /// <param name="voidReasonsCache">A <see cref="INamedValueCache"/> used to get void reason descriptions</param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying languages the current instance supports</param> internal MarketWithSettlement(int id, IReadOnlyDictionary <string, string> specifiers, IReadOnlyDictionary <string, string> additionalInfo, IEnumerable <IOutcomeSettlement> outcomes, INameProvider nameProvider, IMarketMappingProvider mappingProvider, IMarketDefinition marketDefinition, int?voidReason, INamedValueCache voidReasonsCache, IEnumerable <CultureInfo> cultures) : base(id, specifiers, additionalInfo, nameProvider, mappingProvider, marketDefinition, voidReason, voidReasonsCache, cultures) { Contract.Requires(outcomes != null && outcomes.Any()); var readonlyOutcomes = outcomes as IReadOnlyCollection <IOutcomeSettlement>; OutcomeSettlements = readonlyOutcomes ?? new ReadOnlyCollection <IOutcomeSettlement>(outcomes.ToList()); }