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 IIOHelper 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 IOHelper, into an interface (IIOHelper) and an instance class (IOHelper).

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

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

Expected Procedure:

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

If any questions, feel free to ask 😃


Related: AB#3667

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
Shazwazzacommented, Nov 14, 2019

@soreng please leave Umbraco.Core.IO.IOHelper.Default as-is, this can also be used in unit tests if necessary. It shouldn’t be used in the Core/Web projects though, only for registering IIOHelper in DI in the Core/Web Runtime.

1reaction
sorengcommented, Nov 14, 2019

Wow, then my work needs a bit more… work 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Status of migration to .NET Core
Umbraco is moving to .NET Core - here's an updated status on the migration | Let Bjarke take you through the progress and...
Read more >
Dependency injection into views in ASP.NET Core
In this article. ASP.NET Core supports dependency injection into views. This can be useful for view-specific services, such as localization or ...
Read more >
Quick tips to transition from .Net Framework to .Net Core
NB: to use IOptions, you have to add the Microsoft.Extensions.Options library. You can now call it anywhere by accessing the properties in the ......
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