-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created IApplicationInfo and IApplicationStatusInfo for Dependency Injection #3988
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a5f14fe
Created IApplicationInfo and IApplicationStatusInfo interfaces and ma…
SkyeHoefling 04513f6
Fixed failing tests
SkyeHoefling a733773
Fixed more unit tests
SkyeHoefling 90b64f9
Fixed unit tests
SkyeHoefling a81dd60
Fixed last set of failing tests
SkyeHoefling e9dc8a6
Added public default constructor which is required for dependency inj…
SkyeHoefling a3b51b8
Added missing dependency injection registration of IDnnContext
SkyeHoefling dd68762
Fixed up deprecation message to match doc recommendations; Adjusted g…
SkyeHoefling f7ec93f
Added INotifyPropertyChanged to the LazyServiceProvider this allow Gl…
SkyeHoefling 6136fa4
Updated global to immediately resolve dependencies if it doesn't impl…
SkyeHoefling a72aecb
Added mocks for DependencyProvider
SkyeHoefling dd3453a
Fixed failing unit tests
SkyeHoefling 0180aee
Updated navigation manager to follow same pattern as applicationstatu…
SkyeHoefling 95ebc7a
Added mocks for INavigationManager since it needs to be loaded onts a…
SkyeHoefling 044bf40
Added missing .csproj
SkyeHoefling 477b875
Updated dependency registration
SkyeHoefling 1632371
Added the default protected constructor back into the DotNetNukeConte…
SkyeHoefling d27bb3e
Updated deprecation notice on protected constructor
SkyeHoefling d1353db
Updated deprecation notice in Globals.cs to explain on using Dependen…
SkyeHoefling File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
113 changes: 113 additions & 0 deletions
113
DNN Platform/DotNetNuke.Abstractions/Application/IApplicationInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace DotNetNuke.Abstractions.Application | ||
{ | ||
using System; | ||
|
||
/// <summary> | ||
/// The Application class contains properties that describe the DotNetNuke Application. | ||
/// </summary> | ||
public interface IApplicationInfo | ||
{ | ||
/// <summary> | ||
/// Gets the company to which the DotNetNuke application is related. | ||
/// </summary> | ||
/// <value>Fixed result: DotNetNuke Corporation.</value> | ||
string Company { get; } | ||
|
||
/// <summary> | ||
/// Gets the version of the currently installed DotNetNuke framework/application | ||
/// Can be prior to Version, if the application is pending to be upgraded. | ||
/// </summary> | ||
/// <value>The version as retreieved from the database version table.</value> | ||
Version CurrentVersion { get; } | ||
|
||
/// <summary> | ||
/// Gets the description of the application. | ||
/// </summary> | ||
/// <value>Fixed result: DNN Platform.</value> | ||
string Description { get; } | ||
|
||
/// <summary> | ||
/// Gets the help URL related to the DotNetNuke application. | ||
/// </summary> | ||
/// <value>Fixed result: https://dnndocs.com/. </value> | ||
string HelpUrl { get; } | ||
|
||
/// <summary> | ||
/// Gets the legal copyright. | ||
/// </summary> | ||
/// <value>Dynamic: DNN Platform is copyright 2002-todays year by .NET Foundation".</value> | ||
string LegalCopyright { get; } | ||
|
||
/// <summary> | ||
/// Gets the name of the application. | ||
/// </summary> | ||
/// <value>Fixed result: DNNCORP.CE.</value> | ||
string Name { get; } | ||
|
||
/// <summary> | ||
/// Gets the SKU (Stock Keeping Unit). | ||
/// </summary> | ||
/// <value>Fixed result: DNN.</value> | ||
string SKU { get; } | ||
|
||
/// <summary> | ||
/// Gets the status of the DotnetNuke application. | ||
/// </summary> | ||
/// <remarks> | ||
/// If the value is not be Stable, you will see the exactly status and version in page's title if allow display beta message in host setting. | ||
/// </remarks> | ||
/// <value> | ||
/// The value can be: None, Alpha, Beta, RC, Stable. | ||
/// </value> | ||
ReleaseMode Status { get; } | ||
|
||
/// <summary> | ||
/// Gets the title of the application. | ||
/// </summary> | ||
/// <value>Fixed value: DotNetNuke.</value> | ||
string Title { get; } | ||
|
||
/// <summary> | ||
/// Gets the trademark. | ||
/// </summary> | ||
/// <value>Fixed value: DotNetNuke,DNN.</value> | ||
string Trademark { get; } | ||
|
||
/// <summary> | ||
/// Gets the type of the application. | ||
/// </summary> | ||
/// <value>Fixed value: Framework.</value> | ||
string Type { get; } | ||
|
||
/// <summary> | ||
/// Gets the upgrade URL. | ||
/// </summary> | ||
/// <value>Fixed value: https://dnnplatform.io. </value> | ||
string UpgradeUrl { get; } | ||
|
||
/// <summary> | ||
/// Gets the URL of the application. | ||
/// </summary> | ||
/// <value>Fixed value: https://dnncommunity.org.</value> | ||
string Url { get; } | ||
|
||
/// <summary> | ||
/// Gets the version of the DotNetNuke framework/application. | ||
/// </summary> | ||
/// <value>The version as retreieved from the Executing assembly.</value> | ||
Version Version { get; } | ||
|
||
/// <summary> | ||
/// Determine whether a product specific change is to be applied. | ||
/// </summary> | ||
/// <param name = "productNames">list of product names.</param> | ||
/// <returns>true if product is within list of names.</returns> | ||
/// <remarks> | ||
/// </remarks> | ||
bool ApplyToProduct(string productNames); | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
DNN Platform/DotNetNuke.Abstractions/Application/IApplicationStatusInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace DotNetNuke.Abstractions.Application | ||
{ | ||
using System; | ||
|
||
/// <summary> | ||
/// The Application Status Info, includes information about installation | ||
/// and database version. | ||
/// </summary> | ||
public interface IApplicationStatusInfo | ||
{ | ||
/// <summary> | ||
/// Gets the status of application. | ||
/// </summary> | ||
UpgradeStatus Status { get; } | ||
|
||
/// <summary> | ||
/// Gets the application map path. | ||
/// </summary> | ||
/// <value> | ||
/// The application map path. | ||
/// </value> | ||
string ApplicationMapPath { get; } | ||
|
||
/// <summary> | ||
/// Gets the database version. | ||
/// </summary> | ||
Version DatabaseVersion { get; } | ||
|
||
/// <summary> | ||
/// IsInstalled looks at various file artifacts to determine if DotNetNuke has already been installed. | ||
/// </summary> | ||
/// <returns>true if installed else false.</returns> | ||
/// <remarks> | ||
/// If DotNetNuke has been installed, then we should treat database connection errors as real errors. | ||
/// If DotNetNuke has not been installed, then we should expect to have database connection problems | ||
/// since the connection string may not have been configured yet, which can occur during the installation | ||
/// wizard. | ||
/// </remarks> | ||
bool IsInstalled(); | ||
|
||
/// <summary> | ||
/// Sets the status. | ||
/// </summary> | ||
/// <param name="status">The status.</param> | ||
void SetStatus(UpgradeStatus status); | ||
|
||
/// <summary> | ||
/// Updates the database version. | ||
/// </summary> | ||
/// <param name="version">The version.</param> | ||
void UpdateDatabaseVersion(Version version); | ||
|
||
/// <summary> | ||
/// Updates the database version. | ||
/// </summary> | ||
/// <param name="version">The version.</param> | ||
/// <param name="increment">The increment.</param> | ||
void UpdateDatabaseVersionIncrement(Version version, int increment); | ||
|
||
/// <summary> | ||
/// Needs documentation. | ||
/// </summary> | ||
/// <param name="version">The version.</param> | ||
/// <returns>true is success else false.</returns> | ||
bool IncrementalVersionExists(Version version); | ||
|
||
/// <summary> | ||
/// Get the last application iteration. | ||
/// </summary> | ||
/// <param name="version">The version.</param> | ||
/// <returns>The result.</returns> | ||
int GetLastAppliedIteration(Version version); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
DNN Platform/DotNetNuke.Abstractions/Application/IDnnContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace DotNetNuke.Abstractions.Application | ||
{ | ||
/// <summary> | ||
/// Defines the context for the environment of the DotNetNuke application. | ||
/// </summary> | ||
public interface IDnnContext | ||
{ | ||
/// <summary> | ||
/// Gets get the application. | ||
/// </summary> | ||
IApplicationInfo Application { get; } | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
DNN Platform/DotNetNuke.Abstractions/Application/ReleaseMode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace DotNetNuke.Abstractions.Application | ||
{ | ||
/// <summary> | ||
/// The enumeration of release mode. | ||
/// </summary> | ||
/// <value> | ||
/// <list type="bullet"> | ||
/// <item>None: Not specified for the current release.</item> | ||
/// <item>Alpha:Alpha release is an opportunity for customers to get an early look at a particular software feature.</item> | ||
/// <item>Beta: Beta release is a mostly completed release, | ||
/// At this point we will have implemented most of the major features planned for a specific release. </item> | ||
/// <item>RC: RC release will be the Stable release if there is no major show-stopping bugs, | ||
/// We have gone through all the major test scenarios and are just running through a final set of regression | ||
/// tests and verifying the packaging.</item> | ||
/// <item>Stable: Stable release is believed to be ready for use, | ||
/// remember that only stable release can be used in production environment.</item> | ||
/// </list> | ||
/// </value> | ||
public enum ReleaseMode | ||
{ | ||
/// <summary> | ||
/// Not asssigned | ||
/// </summary> | ||
None = 0, | ||
|
||
/// <summary> | ||
/// Alpha release | ||
/// </summary> | ||
Alpha = 1, | ||
|
||
/// <summary> | ||
/// Beta release | ||
/// </summary> | ||
Beta = 2, | ||
|
||
/// <summary> | ||
/// Release candidate | ||
/// </summary> | ||
RC = 3, | ||
|
||
/// <summary> | ||
/// Stable release version | ||
/// </summary> | ||
Stable = 4, | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
DNN Platform/DotNetNuke.Abstractions/Application/UpgradeStatus.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace DotNetNuke.Abstractions.Application | ||
{ | ||
/// <summary> | ||
/// Enumeration Of Application upgrade status. | ||
/// </summary> | ||
public enum UpgradeStatus | ||
{ | ||
/// <summary> | ||
/// The application need update to a higher version. | ||
/// </summary> | ||
Upgrade = 0, | ||
|
||
/// <summary> | ||
/// The application need to install itself. | ||
/// </summary> | ||
Install = 1, | ||
|
||
/// <summary> | ||
/// The application is normal running. | ||
/// </summary> | ||
None = 2, | ||
|
||
/// <summary> | ||
/// The application occur error when running. | ||
/// </summary> | ||
Error = 3, | ||
|
||
/// <summary> | ||
/// The application status is unknown, | ||
/// </summary> | ||
/// <remarks>This status should never be returned. its is only used as a flag that Status hasn't been determined.</remarks> | ||
Unknown = 4, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added
INotifyPropertyChanged
here to allow theGlobals.cs
to listen for an event when the Service Provider is ready for us. Since theGlobals.cs
is wrapping several Dependency Injection calls as we deprecate methods it is important that it can resolve dependencies once they are available. This is critical when usingGlobals.cs
at startup.I decided on
INotifyPropertyChanged
as it is a .NET Standard type and is used in the desktop/mobile space a lot for notifying objects when something has changed. If there is a better option, I am more than happy to change this