Wangkanai.Responsive 2.0.0-beta4

ASP.NET Core Responsive middleware for routing base upon request clientInfo device detection to specific view
Being to target difference clientInfo devices with seperation of concern is crucial, due to you can mininize what is sent to the clientInfo directly from the service to only what is needed and nothing more. This increase performance and lower bandwidth usage.

This is a prerelease version of Wangkanai.Responsive.
The owner has unlisted this package. This could mean that the package is deprecated or shouldn't be used anymore.
Install-Package Wangkanai.Responsive -Version 2.0.0-beta4
dotnet add package Wangkanai.Responsive --version 2.0.0-beta4
<PackageReference Include="Wangkanai.Responsive" Version="2.0.0-beta4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Wangkanai.Responsive --version 2.0.0-beta4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

ASP.NET Core Responsive

Build status
NuGet Pre Release

ASP.NET Core Responsive

ASP.NET Core Responsive middleware for routing base upon request client device detection to specific view.
Being to target difference client devices with seperation of concern is crucial, due to you can mininize what is sent to the client directly from the service to only what is needed and nothing more. This increase performance and lower bandwidth usage.

Installation

Installation of Responsive library will bring in all dependency packages.

PM> install-package Wangkanai.Responsive -pre

Configure Service

Responsive is configured in the ConfigureServices method:

public void ConfigureServices(IServiceCollection services)
{
    // Add responsive services.
    services.AddResponsive()
        .AddViewSuffix()
        .AddViewSubfolder();

    // Add framework services.
    services.AddMvc();  
}
  • AddResponsive() Adds the Responsive services to the services container.

  • AddViewSuffix() Adds support for device view files to Suffix. In this sample view Responsive is based on the view file suffix.

    Ex *views/[controller]/[action]/index.mobile.cshtml*

  • AddViewSubfolder() Adds support for device view files to Subfolder. In this sample view Responsive is based on the view file subfolder.

    Ex *views/[controller]/[action]/mobile/index.cshtml*

Configure Middleware

The current device on a request is set in the Responsive middleware. The Responsive middleware is enabled in the Configure method of Startup.cs file.

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    app.UseResponsive();

    app.UseMvc(routes =>
    {
        routes.MapRoute(
            name: "default",
            template: "{controller=Home}/{action=Index}/{id?}");
    });
}
  • UseResponsive() Add the responsive middleware into the http pipeline. Its will capture the request and resolve the device to responsive services container.

Customized able options (beta 3)

This enable the middleware to customized the default response for any type of request device to the configured options.

app.UseResponsive(new ResponsiveOptions
{
    TabletDefault = DeviceType.Mobile
});
  • ResponsiveOptions has 3 default configurable via DesktopDefault, TabletDefault, and MobileDefault.

Directory Structure

  • src - The code of this project lives here
  • test - Unit tests of this project to valid that everything pass specs
  • sample - Contains sample web application of usage

Contributing

All contribution are welcome, please contact the author.

Related projects

See the LICENSE file.

ASP.NET Core Responsive

Build status
NuGet Pre Release

ASP.NET Core Responsive

ASP.NET Core Responsive middleware for routing base upon request client device detection to specific view.
Being to target difference client devices with seperation of concern is crucial, due to you can mininize what is sent to the client directly from the service to only what is needed and nothing more. This increase performance and lower bandwidth usage.

Installation

Installation of Responsive library will bring in all dependency packages.

PM> install-package Wangkanai.Responsive -pre

Configure Service

Responsive is configured in the ConfigureServices method:

public void ConfigureServices(IServiceCollection services)
{
    // Add responsive services.
    services.AddResponsive()
        .AddViewSuffix()
        .AddViewSubfolder();

    // Add framework services.
    services.AddMvc();  
}
  • AddResponsive() Adds the Responsive services to the services container.

  • AddViewSuffix() Adds support for device view files to Suffix. In this sample view Responsive is based on the view file suffix.

    Ex *views/[controller]/[action]/index.mobile.cshtml*

  • AddViewSubfolder() Adds support for device view files to Subfolder. In this sample view Responsive is based on the view file subfolder.

    Ex *views/[controller]/[action]/mobile/index.cshtml*

Configure Middleware

The current device on a request is set in the Responsive middleware. The Responsive middleware is enabled in the Configure method of Startup.cs file.

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    app.UseResponsive();

    app.UseMvc(routes =>
    {
        routes.MapRoute(
            name: "default",
            template: "{controller=Home}/{action=Index}/{id?}");
    });
}
  • UseResponsive() Add the responsive middleware into the http pipeline. Its will capture the request and resolve the device to responsive services container.

Customized able options (beta 3)

This enable the middleware to customized the default response for any type of request device to the configured options.

app.UseResponsive(new ResponsiveOptions
{
    TabletDefault = DeviceType.Mobile
});
  • ResponsiveOptions has 3 default configurable via DesktopDefault, TabletDefault, and MobileDefault.

Directory Structure

  • src - The code of this project lives here
  • test - Unit tests of this project to valid that everything pass specs
  • sample - Contains sample web application of usage

Contributing

All contribution are welcome, please contact the author.

Related projects

See the LICENSE file.

Version History

Version Downloads Last updated
2.0.0-beta11 50 5/2/2019
2.0.0-beta04 38 5/3/2019