Skip to content
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

HttpRequest Extensions #1

Closed
wangkanai opened this issue Aug 30, 2016 · 8 comments
Closed

HttpRequest Extensions #1

wangkanai opened this issue Aug 30, 2016 · 8 comments

Comments

@wangkanai
Copy link
Owner

Adding extensible to existing usage scenario is a key design. So I would like to propose a concept of extending the HttpRequest for developer to access the Browser, Device, Platform, Engine directly. This extension then retrieve the instance from the BrowserService.

var browser = HttpContext.Request.Browser();
var platform = HttpContext.Request.Platform();
var device = HttpContext.Request.Device();
var engine = HttpContext.Request.Engine();

I would like to hear the community regarding this concept.

@wangkanai wangkanai added this to the beta3 milestone Aug 30, 2016
wangkanai added a commit that referenced this issue Aug 31, 2016
@wangkanai wangkanai modified the milestones: beta4, beta3, beta5 Sep 19, 2016
@wangkanai
Copy link
Owner Author

static class and constructor has issue with dependency injection.
so the milestone will be postpone out

@wangkanai
Copy link
Owner Author

#60

@mrnams
Copy link

mrnams commented Oct 20, 2018

Supeb,
Very nice design,that will help all to use without going into complicated things

wangkanai added a commit that referenced this issue Nov 15, 2018
@wangkanai
Copy link
Owner Author

I have found a for this to work now.

@wangkanai wangkanai reopened this Nov 15, 2018
@wangkanai wangkanai changed the title HttpRequest Extensions (concept) HttpRequest Extensions Nov 15, 2018
@wangkanai
Copy link
Owner Author

The usage has got simpler than what is expected.

var browser = Request.Browser();
var platform = Request.Platform();
var device = Request.Device();
var engine = Request.Engine();

Example of usage

public IActionResult Index()
{
    ViewData["Device"] = Request.Device().Type;
    return View(_resolver);
}

@wangkanai wangkanai added this to the 2.0 beta10 milestone Nov 15, 2018
wangkanai added a commit that referenced this issue Nov 15, 2018
@wangkanai wangkanai removed the concept label Nov 15, 2018
wangkanai added a commit that referenced this issue Nov 15, 2018
#1 Add extensions to HttpRequest
@wangkanai
Copy link
Owner Author

wangkanai commented Nov 15, 2018

Calling community, please add test units

@vovikdrg
Copy link
Contributor

vovikdrg commented Feb 1, 2019

@wangkanai do you still need help with unittests?

@wangkanai
Copy link
Owner Author

@vovikdrg yap 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants