.Net Core transition: Inject IIOHelper wherever possible
See original GitHub issueThis 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:
- Created 4 years ago
- Comments:19 (19 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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.Wow, then my work needs a bit more… work 😉