.Net Core transition: Inject IUmbracoVersion 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 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:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Awesome, thanks @bergmania! Happy to help, I will look out for more up for grabs issues 😃
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/7179The 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!