Today Microsoft released version 18.104.22.168 of Windows Azure Media Services .NET SDK which is hosted in nuget.org http://bit.ly/1gUB34k.
22.214.171.124 is a minor release addressing few bug fixes,code refactoring within sdk code base and splitting scenario e2e tests from unit tests into different solutions.
I want to highlight few changes which recently have been made in 126.96.36.199 and 188.8.131.52 versions which might be beneficial for you application performance.
CloudMediaContext is a first type which you use to talk with REST api. It encapsulate logic to get access token from Azure ACS service and provides you easy entry point to available entity collections to work with.
Prior to 184.108.40.206 every time you create instance of CloudMediaContext WAMS .NET SDK was sending to REST API 2 requests:
To optimize performance in multithreaded, multi instance scenarios like web farm you want to get a token and end point from REST once and have ability recreate CloudMediaContext based on values which you already got previously.
MediaServicesCredentials mediaServicesCredentials = new MediaServicesCredentials("myaccount", "mykey"); CloudMediaContext cntx = new CloudMediaContext(mediaServicesCredentials); //At this point token is null since no request issued to ACS yet string token = mediaServicesCredentials.AccessToken; //We are sending Request to ACS and Detecting endpoint only when we first time accessing our entities from collections var asset = cntx.Assets.FirstOrDefault(); DateTime exprires = mediaServicesCredentials.TokenExpiration; //You can save token to cache and reassign it later in order to avoid request to ACS //Example: // MediaServicesCredentials mediaServicesCredentials = new MediaServicesCredentials("myaccount", "mykey"); // mediaServicesCredentials.AccessToken == token; //You can also force token Refresh earlier. Please note that refresh happen automatically if token has been expired mediaServicesCredentials.RefreshToken();
As you can see from example above newly added constructor allows you to create credential object and have direct access to acs token value and it’s expiration. Once you get these values in session memory or distributed db you will be able to use it in order to recreate MediaServicesCredentials and CloudMediaContext in multiple threads without hitting ACS over and over again. Please note that you need to provide account name and key since these values are used in order to refresh token once it will be expired.
In 220.127.116.11 we fixed issues related to usage of LINQ queries with OrderBy statements:
var asset1 = _mediaContext .Assets .OrderByDescending(c => c.Created) .Where(a => a.Name.Length > 1) .Skip(10) .Take(5) .First(); var asset2 = _mediaContext .Assets .Where(a => a.Name.Length > 1) .Skip(10) .Take(5) .First(); var asset3 = _mediaContext .Assets .Where(a => a.Name.Length > 1) .OrderByDescending(c => c.Created) .Skip(10) .Take(5) .First();
As you might know all WAMS SDK code is hosted in github at https://github.com/WindowsAzure/azure-sdk-for-media-services giving developers ability to fork, explore and contribute.
Test solution has been splited into 2 separate solutions:
Also there were several refactoring within code base to make code more modular and mockable.