# Migration Guide

The ***Sportradar.OddsFeed.SDKCore*** library target framework was downgraded from .NET Standard 2.1 to .NET Standard 2.0, so this package can be used in any .NET Core and .NET project and also in old .NET Framework 4.6.2 or newer.&#x20;

No upgrades are planned for the package ***Sportradar.OddsFeed.SDK*** in the future and solutions should be upgraded to use ***Sportradar.OddsFeed.SDKCore*** and this is your roadmap to a smooth transition from your current SDK version to the latest version.&#x20;

The upgrade is designed to elevate your experience and align the SDK more closely with your business needs.

Here are the general steps you can follow to complete the transition:

#### **1. Upgrade Dependencies** <a href="#uof.netsdkmigrationguide-1.upgradedependencies" id="uof.netsdkmigrationguide-1.upgradedependencies"></a>

Upgrade ***Sportradar.OddsFeed.SDKCore*** Nuget package to 2.0.0. Before upgrading you might need to upgrade some of the dependent libraries, like libraries for logging or dependency injection.

SDK dependent libraries were upgraded or replaced.

<br>

Removed Libraries

| *Newtonsoft.Json* |
| ----------------- |
| *Castle.Core*     |

Libraries Added

| *Microsoft.Extensions.Diagnostics.HealthChecks* | *7.0.11* |
| ----------------------------------------------- | -------- |
| *Microsoft.Extensions.Http*                     | *7.0.0*  |

Libraries Upgraded / Replaced

|                                             | From     | To       |
| ------------------------------------------- | -------- | -------- |
| *Humanizer*                                 | *2.8.26* | *2.14.1* |
| *RabbitMQ.Client*                           | *5.1.2*  | *6.5.0*  |
| *Microsoft.Extensions.Logging.Abstractions* | *3.1.0*  | *7.0.0*  |
| *System.Configuration.ConfigurationManager* | *4.7.0*  | *7.0.0*  |

| *Replaced*               | *with*                                           |
| ------------------------ | ------------------------------------------------ |
| *App.Metrics*            | *OpenTelemetry 1.6.0*                            |
| *System.Runtime.Caching* | *Microsoft.Extensions.Caching.Memory 7.0.0*      |
| *Unity*                  | *Microsoft.Extensions.DependencyInjection 7.0.0* |

#### 2. Build new UofSdk instance <a href="#uof.netsdkmigrationguide-2.buildnewuofsdkinstance" id="uof.netsdkmigrationguide-2.buildnewuofsdkinstance"></a>

The feed instance is now named UofSdk. Building new feed instance is changed. You need to build configuration and register all the sdk services before creating new UofSdk instance.

```javascript
var uofConfiguration = UofSdk.GetConfigurationBuilder().BuildFromConfigFile();
var services = new ServiceCollection();
services.AddUofSdk(uofConfiguration);
var uofSdk = new UofSdk(services.BuildServiceProvider());
```

{% hint style="info" %}
Note

When configuring WebHost services (as in ASP.NET Core apps) via WebApplicationBuilder you should create scope before creating UofSdk. Registering services for logging, telemetry and user classes is omitted for simplicity (but dont forget to add them).
{% endhint %}

```javascript
var webAppBuilder = WebApplication.CreateBuilder(args).WebHost.ConfigureServices(
(hostBuilderContext, serviceCollection) => {   
 serviceCollection.AddUofSdk(configuration);
});
 
var app = webAppBuilder.Build();
 
var uofSdk = new UofSdk(app.Services.CreateScope().ServiceProvider);
```

#### **3. Update the methods and classes in your code** <a href="#uof.netsdkmigrationguide-3.updatethemethodsandclassesinyourcode" id="uof.netsdkmigrationguide-3.updatethemethodsandclassesinyourcode"></a>

Review your codebase to identify any parts that might be affected by the upgrade. Look for deprecated methods or classes that have been removed in the new version. Update your code to use the new APIs provided by the UOF Java SDK 3.0.0. This may involve making changes to method calls, imports, and class references. Handle any breaking changes or deprecations by updating your code accordingly. You can contact support if you encounter specific issues.

The following classes and methods are changed. Hence, you will be needed to update your code to use new names.

**Root Classes Renamed**

* ```
  IOddsFeed to IUofSdk 
  ```
* ```
  IOddsFeedSession to IUofSession
  ```
* ```
  Feed to UofSdk
  ```
* ```
  ReplayFeed to UofSdkForReplay
  ```
* ```
  IOddsFeedExt to IUofSdkExtended
  ```
* ```
  FeedExt to UofSdkExtended
  ```
* ```
  IOddsFeedConfigurationSection to IUofConfigurationSection
  ```
* ```
  OddsFeedConfigurationSection to UofConfigurationSection
  ```
* ```
  IOddsFeedConfiguration to IUofConfiguration
  ```
* ```
  Removed OperationManager (properties moved to IUofConfiguration)
  ```
* ```
  IEnvironmentSelector - removed SelectIntegration() and SelectProduction() - use SelectEnvironment(SdkEnvironment ufEnvironment)
  ```
* ```
  Renamed Feed.CreateBuilder() to UofSdk.GetSessionBuilder() for creating new IUofSession
  ```
* ```
  config section moved to Sportradar.OddsFeed.SDK.Api.Internal.Config.UofConfigurationSection
  ```

**Removed methods and classes**

* ```
  IOutcomeSettlement.Result
  ```
* ```
  IOddsFeedConfigurationSection.UseIntegrationEnvironment
  ```
* ```
  IRound.GroupName
  ```
* ```
  IRound.GetGroupName()
  ```

**Added or changed methods**

* ```
  Added support for IVenue.Courses (returns list of ICourse instead of list of IHole)
  ```

**Enum values renamed to CamelCase**

* ```
  MessageType
  ```
* ```
  ExceptionHandlingStrategy
  ```
* ```
  CashoutStatus
  ```
* ```
  FixtureChangeType
  ```
* ```
  MarketStatus
  ```
* ```
  OddsChangeReason
  ```
* ```
  PropertyUsage
  ```
* ResourceTypeGroup<br>

**Changes and/or new features**

* Added support for IVenue.Courses (returns list of ICourse instead of list of IHole)
* Added support for ICompetitor.Division - now contains division id and name (moved and replaced from ITeamCompetitor)
* Extended IJersey with SquareColor and HorizontalStripesColor

**Name changes**

The following are changed to improve the consistency. Some classes were also moved to different namespace:

| Renamed                                  | to                    |
| ---------------------------------------- | --------------------- |
| URN                                      | Urn                   |
| ReplayPlayerStatus.Setting\_up           | SettingUp             |
| IFixture.StartTimeTBD                    | StartTimeTbd          |
| EventStatus.Not\_Started                 | NotStarted            |
| FeedMessage.EventURN                     | EventUrn              |
| IRound.Name                              | Names                 |
| IRound.PhaseOrGroupLongName              | PhaseOrGroupLongNames |
| <p>IProducerManager.Get()</p><p><br></p> | GetProducer()         |

**Changed namespaces**

| <p><br></p>    | renamed to |
| -------------- | ---------- |
| API namespace  | Api        |
| REST namespace | Rest       |

| <p><br></p>              | moved to            |
| ------------------------ | ------------------- |
| replay interfaces        | Api.Replay          |
| feed managers            | Api.Managers        |
| feed providers           | Api.Managers        |
| enum types               | Common.Enums        |
| IUofConfigurationSection | Api.Internal.Config |
| configuration interfaces | Api.Config          |
| MessageInterest class    | Api.Config          |

#### 4. Update the Configuration <a href="#uof.netsdkmigrationguide-4.updatetheconfiguration" id="uof.netsdkmigrationguide-4.updatetheconfiguration"></a>

The configuration settings were split between configuration class and OperationManager. OperationManager is removed and all settings are consolidated within the **`IUofConfiguration`**  interface. &#x20;

You have two ways for constructing to build final configuration:

1. combining App.config and IConfigurationBuilder or
2. just programmatically via IConfigurationBuilder.

Some of the options were removed from App.config section options and can only be configured via configuration builder.

**Upgrade configuration in App.config**

**Replace**

| `<configSections><section` `name="oddsFeedSection"` `type="Sportradar.OddsFeed.SDK.API.Internal.OddsFeedConfigurationSection, Sportradar.OddsFeed.SDK"` `/></configSections>` |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

**with**

| `<configSections><section` `name="uofSdkSection"` `type="Sportradar.OddsFeed.SDK.Api.Internal.Config.UofConfigurationSection, Sportradar.OddsFeed.SDK"` `/></configSections>` |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

**Other changes**

You'll need to re-configure the following either in the properties file or YAML.

| Keys                                  | <p><br></p> | Comments                                                                                                                                                                                                                    |
| ------------------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *accessToken*                         | required    | The token you are currently using can also be used with our new version.                                                                                                                                                    |
| *defaultLanguage or desiredLanguages* | required    | *Note: desiredLanguages is renamed from supportedLanguages*                                                                                                                                                                 |
| *nodeId*                              | optional    | Recommended to be set – must be unique per sdk instance                                                                                                                                                                     |
| *environment*                         | optional    | <p>if not set, '<em>Integration</em>' will be used.</p><p><em>Note: Renamed from ufEnvironment.</em></p>                                                                                                                    |
| *supportedLanguages*                  | <p><br></p> | This is removed. Use desiredLanguages.                                                                                                                                                                                      |
| *inactivitySeconds*                   | -           | This is removed from App.config. However, you can set this through configuration builder.                                                                                                                                   |
| *host*                                | optional    | Sets the URL of the messaging host/broker i.e. [mq.betradar.com](http://mq.betradar.com/). This setting should only be set when using Custom environment.                                                                   |
| *useSsl*                              | optional    | <p>Sets the value indicating whether a secure connection to the message broker should be used (true or false). This setting should only be set when using Custom environment.</p><p><em>Note: Renamed from useSSL.</em></p> |
| *virtualHost*                         | optional    | Sets the name of the virtual host configured on the messaging server (broker). This setting should only be set when using Custom environment.                                                                               |
| *apiHost*                             | optional    | Sets the URL of the API host ([https://api.betradar.com](https://api.betradar.com/)). This setting should only be set when using custom environment.                                                                        |
| *apiUseSsl*                           | optional    | <p>Sets the value indicating whether a secure connection to the Sports API should be used. This setting should only be set when using Custom environment.</p><p><em>Note: This is renamed from useApiSSL.</em></p>          |
| *exceptionHandlingStrategy*           | optional    | Sets a ExceptionHandlingStrategy enum member specifying how to handle exceptions thrown to outside callers (‘Catch’ or ‘Throw’).                                                                                            |
| *disabledProducers*                   | optional    | Sets the comma delimited list of ids of disabled producers (e.g. '1,2,7,9').                                                                                                                                                |
| *maxRecoveryTime*                     | optional    | This is removed from App.config. However, you can set this through configuration builder.                                                                                                                                   |
| *adjustAfterAge*                      | optional    | This is removed from App.config. However, you can set this through configuration builder.                                                                                                                                   |
| *httpClientTimeout*                   | optional    | This is removed from App.config. However, you can set this through configuration builder.                                                                                                                                   |
| *recoveryHttpClientTimeout*           | optional    | This is removed from App.config. However, you can set this through configuration builder.                                                                                                                                   |

**Through ConfigurationBuilder**

The full configuration can be also setup via ConfigurationBuilder obtained via `uofSdk.getUofConfigurationBuilder()` . The resulting UofConfiguration contains all the previously set configurations for the SDK.

#### **5. Test your project** <a href="#uof.netsdkmigrationguide-5.testyourproject" id="uof.netsdkmigrationguide-5.testyourproject"></a>

Thoroughly test your project after making the changes. Test all critical functionality to ensure that everything still works as expected. Pay special attention to any areas of your setup that interact with the sdk, as these are likely to be the most affected by the upgrade.

#### **6. Update the Documentation** <a href="#uof.netsdkmigrationguide-6.updatethedocumentation" id="uof.netsdkmigrationguide-6.updatethedocumentation"></a>

Update your project's documentation and any training materials to reflect the changes introduced by the upgrade. This will help your team members understand and work with the new version.

#### **7. Deploy to production** <a href="#uof.netsdkmigrationguide-7.deploytoproduction" id="uof.netsdkmigrationguide-7.deploytoproduction"></a>

Once you are confident that your project works correctly with the upgraded sdk, you can deploy the updated version to your production environment.

#### **8. Monitoring and Maintenance** <a href="#uof.netsdkmigrationguide-8.monitoringandmaintenance" id="uof.netsdkmigrationguide-8.monitoringandmaintenance"></a>

After deployment, monitor your project closely for any unexpected issues or performance problems. Be prepared to address any post-upgrade issues promptly.

#### **9. Feedback and Reporting** <a href="#uof.netsdkmigrationguide-9.feedbackandreporting" id="uof.netsdkmigrationguide-9.feedbackandreporting"></a>

If you encounter any bugs or issues in the UOF NetStandard SDK 2.0.0, consider reporting them to <support@sportradar.com>. Providing feedback can help improve the SDK for future releases.
