question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.Net Core transition: Inject IUmbracoVersion wherever possible

See original GitHub issue

This task is up for grabs, for contributing to the .Net Core transition project

On the development branch of the .net core transition project netcore/dev, we have already abstracted the static UmbracoVersion, into an interface (IUmbracoVersion) and an instance class (UmbracoVersion ).

This was required to unblock some other tasks. To finish that task as fast as possible, we just added a new static property on the static helper Current (Current.UmbracoVersion). This new static property is used all over the system, instead of the original static UmbracoVersion.

This task is about eliminating the usage of Current.UmbracoVersion, by replacing it with a constructor injection of IUmbracoVersion.

Be aware, Current exists in both Umbraco.Core.Composing and Umbraco.Web.Composing.

Expected Procedure:

  • Find an instance class that uses Current.UmbracoVersion.
  • Add IUmbracoVersion umbracoVersion to the constructor.
  • Save the umbracoVersion in a private readonly IUmbracoVersion _umbracoVersion; field.
  • Replace the usages of Current.UmbracoVersion.* with _umbracoVersion.*.
  • Make sure the project builds
  • Ensure unit tests all pass
  • Repeat the process

If any questions, feel free to ask 😃


Related: AB#3865

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
crgrievecommented, Nov 20, 2019

Awesome, thanks @bergmania! Happy to help, I will look out for more up for grabs issues 😃

0reactions
bergmaniacommented, Nov 20, 2019

Hi @crgrieve

You almost took all the necessary ones -I updated with a few missing…

Now, all that is back is in PackageDefinistion and the membership providers…

I know the one in PackageDefinistion is handled in https://github.com/umbraco/Umbraco-CMS/pull/7179

The ones in Membership providers is okay for now because these classes will probably be removed when we need to implement the Member stuff in a netstandard-compatible way.

Thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

.NET Core transition: Inject IShortStringHelper wherever ...
When this is used, we cannot move the class into Umbraco.Abstractions or Umbraco.Infrastructure. This task is about eliminating the usage of ...
Read more >
Strategies for migrating ASP.NET Web Forms apps
You can migrate your Web Forms functionality to ASP.NET Core successfully by: Keeping non-web functionality out of your projects. Using web APIs ...
Read more >
Incremental ASP.NET to ASP.NET Core Migration
A simple pattern to apply the Strangler Fig pattern to migrating ASP.NET to ASP.NET Core applications with the help of some new adapters....
Read more >
A Better Way to Inject AppSettings in Asp.NET Core
The idea of defining configuration settings and being able to access them anywhere using an injected instance of IConfiguration . Basically, my appSettings.json ......
Read more >
New dependency injection features in .NET 6
In this post I talk about some of the new features added to the DI libraries in .NET 6, as well a performance...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found