Skip to content

Commit

Permalink
Resolved 249 build warnings in Library project (#4215)
Browse files Browse the repository at this point in the history
* Resolved 249 build warnings in Library project

This PR focuses a bit in the Common.Globals file. I have resolved many build warnings and also deprecated some unused public methods that I believe should have never been made public.

All feedback is welcome

* Resolves some more warnings in Globals.cs

* Removed one wrong todo

* Update DNN Platform/DotNetNuke.Abstractions/Application/IApplicationStatusInfo.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Common/Globals.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Addresses PR concerns with v10 vs v11 deprecations

* Update DNN Platform/Library/Common/Globals.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Common/Globals.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Common/Globals.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Removed TODO on IsEditMode

* Removed stale TODO

* Renames some variables for clarity and corrected typos

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>
  • Loading branch information
valadas and bdukes committed Oct 22, 2020
1 parent 49b7291 commit 6e7228e
Show file tree
Hide file tree
Showing 8 changed files with 4,028 additions and 3,913 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,18 @@ public interface IApplicationStatusInfo
void UpdateDatabaseVersionIncrement(Version version, int increment);

/// <summary>
/// Needs documentation.
/// Checks if incremental sqlDataProvider files exist.
/// </summary>
/// <example>If a 09.08.01.01.sqlDataProvider file exists for a provided version 09.08.01 this method will return true.</example>
/// <param name="version">The version.</param>
/// <returns>true is success else false.</returns>
/// <returns>A value indicating whether any incremental sql script file exists.</returns>
bool IncrementalVersionExists(Version version);

/// <summary>
/// Get the last application iteration.
/// Get the last applied iteration (revision) for a given version.
/// </summary>
/// <param name="version">The version.</param>
/// <returns>The result.</returns>
/// <param name="version">The version to check.</param>
/// <returns>The last applied iteration (revision).</returns>
int GetLastAppliedIteration(Version version);
}
}
10 changes: 5 additions & 5 deletions DNN Platform/Library/Collections/PageSelector{T}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace DotNetNuke.Collections
/// <typeparam name = "T">The type of object in the data store.</typeparam>
public class PageSelector<T>
{
private readonly int _pageSize;
private readonly IEnumerable<T> _source;
private readonly int pageSize;
private readonly IEnumerable<T> source;

/// <summary>
/// Initializes a new instance of the <see cref="PageSelector{T}"/> class.
Expand All @@ -23,8 +23,8 @@ public class PageSelector<T>
/// <param name = "pageSize">The size of each page.</param>
public PageSelector(IEnumerable<T> source, int pageSize)
{
this._source = source;
this._pageSize = pageSize;
this.source = source;
this.pageSize = pageSize;
}

/// <summary>
Expand All @@ -37,7 +37,7 @@ public PageSelector(IEnumerable<T> source, int pageSize)
/// </returns>
public IPagedList<T> GetPage(int pageIndex)
{
return new PagedList<T>(this._source, pageIndex, this._pageSize);
return new PagedList<T>(this.source, pageIndex, this.pageSize);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// 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
// 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.Common.Controls
{
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;

using System.Web.UI.HtmlControls;

/// <summary>
/// The Form will reset action to raw url instead of rewrite url.
/// </summary>
public class Form : HtmlForm
{
/// <inheritdoc/>
{
/// <inheritdoc/>
protected override void RenderAttributes(HtmlTextWriter writer)
{
var stringWriter = new StringWriter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,79 @@
// 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.Common.Extensions
{
using System.Web;

using Microsoft.Extensions.DependencyInjection;

public static class HttpContextDependencyInjectionExtensions
{
public static void SetScope(this HttpContextBase httpContext, IServiceScope scope)
{
httpContext.Items[typeof(IServiceScope)] = scope;
}

public static void SetScope(this HttpContext httpContext, IServiceScope scope)
{
httpContext.Items[typeof(IServiceScope)] = scope;
}

public static void ClearScope(this HttpContext httpContext)
{
httpContext.Items.Remove(typeof(IServiceScope));
}

public static IServiceScope GetScope(this HttpContextBase httpContext)
{
return GetScope(httpContext.Items);
}

public static IServiceScope GetScope(this HttpContext httpContext)
{
return GetScope(httpContext.Items);
}

internal static IServiceScope GetScope(System.Collections.IDictionary contextItems)
{
if (!contextItems.Contains(typeof(IServiceScope)))
{
return null;
}

return contextItems[typeof(IServiceScope)] is IServiceScope scope ? scope : null;
}
}
}
namespace DotNetNuke.Common.Extensions
{
using System.Web;

using Microsoft.Extensions.DependencyInjection;

/// <summary>
/// Dependency injection extensions for HttpContext.
/// </summary>
public static class HttpContextDependencyInjectionExtensions
{
/// <summary>
/// Sets the service scope for the http context base.
/// </summary>
/// <param name="httpContext">The http context base.</param>
/// <param name="scope">The service scope.</param>
public static void SetScope(this HttpContextBase httpContext, IServiceScope scope)
{
httpContext.Items[typeof(IServiceScope)] = scope;
}

/// <summary>
/// Sets the service scope for the http context.
/// </summary>
/// <param name="httpContext">The http context.</param>
/// <param name="scope">The service scope.</param>
public static void SetScope(this HttpContext httpContext, IServiceScope scope)
{
httpContext.Items[typeof(IServiceScope)] = scope;
}

/// <summary>
/// Clears the service scope for the http context.
/// </summary>
/// <param name="httpContext">The http context on which to clear the service scope.</param>
public static void ClearScope(this HttpContext httpContext)
{
httpContext.Items.Remove(typeof(IServiceScope));
}

/// <summary>
/// Gets the http context base service scope.
/// </summary>
/// <param name="httpContext">The http context base from which to get the scope from.</param>
/// <returns>A service scope.</returns>
public static IServiceScope GetScope(this HttpContextBase httpContext)
{
return GetScope(httpContext.Items);
}

/// <summary>
/// Gets the http context service scope.
/// </summary>
/// <param name="httpContext">The http context from which to get the scope from.</param>
/// <returns>A service scope.</returns>
public static IServiceScope GetScope(this HttpContext httpContext)
{
return GetScope(httpContext.Items);
}

/// <summary>
/// Gets the service scope from a collection of context items.
/// </summary>
/// <param name="contextItems">A dictionary of context items.</param>
/// <returns>The found service scope.</returns>
internal static IServiceScope GetScope(System.Collections.IDictionary contextItems)
{
if (!contextItems.Contains(typeof(IServiceScope)))
{
return null;
}

return contextItems[typeof(IServiceScope)] is IServiceScope scope ? scope : null;
}
}
}
Loading

0 comments on commit 6e7228e

Please sign in to comment.