Earlier this month I finally had some time to upgrade the Umbraco 9 Demo Site from the beta to the latest RC, and while doing so I got some breaking changes that I had to adjust the code in order for my project to work, and I thought I would share these finding in this really small blogpost.
Note that since I did this upgrade the official Umbraco 9 version has been released and I am not sure if there are any breaking changes between the RC and the official version, in that case I might cover those in another blogpost once I find the time to upgrade the demo site to the official 9 version.
IOptionsSnapshot > IOptionsMonitor
In the demo site we have an example of how to do custom indexing used for indexing external products (from API) in Examine. Once I upgraded the project I found that the UmbracoExamineIndex base class no longer accepts an IOptionsSnapshot in the constructor but instead wants a IOptionsMonitor. Seems to be working just the same, just a new naming I guess.
IUmbracoContextAccessor.UmbracoContext > IUmbracoContextAccessor.TryGetUmbracoContext
In a few places in the demo site we are accessing the UmbracoContext based on the IUmbracoContextAccessor and I found that the way this service accesses the UmbracoContext has changed. For the better I should say! Now instead of accessing the UmbracoContext directly we now access it using TryGetUmbracoContext. Once I changed the way I accessed it, is seems to be working just the same.
Obviously this also changed my unit tests accordingly:
I told you it would be a really small blogpost, didn't I? 😉
Hope these findings could be useful to someone!
Cheers friends! ❤️