• Basics
  • Abyss
  • Web APIs
  • C# & Razor
  • .net API
  • JS & TS API

    Show / Hide Table of Contents

    Class DnnExtensions

    Provides extension methods for DNN Skins (Themes) and Modules. It only exists on the Dnn platform, not on Oqtane.

    Inheritance
    System.Object
    DnnExtensions
    Namespace: ToSic.Sxc.Services
    Assembly: ToSic.Sxc.Dnn.Core.dll
    Syntax
    [PublicApi]
    public static class DnnExtensions
    Remarks

    Created v14

    Methods

    | Improve this Doc View Source

    GetScopedService<T>()

    Get a service from the current HTTP Scope. This is the standalone method.

    Declaration
    public static T GetScopedService<T>()
    Returns
    Type Description
    T

    A service of type T - if it can be found. Otherwise it will throw an error.

    Type Parameters
    Name Description
    T
    Remarks

    This requires an HttpContext.Current to exist, so it will not work within a search controller.

    History

    • Created in v14
    • In v15.03 added special patch so it work on 404 pages where the service provider is broken/not available
    | Improve this Doc View Source

    GetScopedService<T>(UserControl)

    Helper extension method to get a scoped service on a skin/theme or module.

    To call it you must prefix it with this. like this.GetScopedService...

    Declaration
    public static T GetScopedService<T>(this UserControl skinOrModule)
    Parameters
    Type Name Description
    System.Web.UI.UserControl skinOrModule
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    Remarks

    This requires an HttpContext.Current to exist, so it will not work within a search controller.

    History

    • Created in v14
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX