Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>File names don't mean anything for classes, so I'm not sure what are you envisioning with the "HomeController.Mobile.cs" idea. You can't have two HomeController classes by the same name so it's either separate controllers/areas/apps or a shared one, as you noted.</p> <p>If you go with the default convention and have the same controller, you can fork off your logic based on device type:</p> <pre><code>if (HttpContext.GetOverriddenBrowser().IsMobileDevice) { //mobile specific logic } </code></pre> <p>If you find that many controllers/actions have different logic depending on the device type then I'd argue that <strong>you have separate applications</strong> and it <em>does</em> make sense to use an area or even a separate web application if needed, IMHO. I'd try to decide what path I went based on this.</p> <p>Edit to address the comments:</p> <p>I understand what you want; I had to do something similar when I tried to make a jQuery Mobile version of my blog. Basically, there are 3 options as I see it:</p> <ol> <li>Controllers with a single set of logic that retrieves all data for all views. Each view simply uses what it needs.</li> <li>Controllers with an "if(isMobile)" that does certain logic and returns a mobile view in the case of mobile devices, and does different logic and returns the default view in others.</li> <li>A completely separate area or application explicitly for mobile (eg. mobile.yourapp.com)</li> </ol> <p>Sounds like you don't want #2 or #3, so have you considered #1? The bottleneck in mobile devices is its resources and the network, so I wouldn't be too concerned if your server had to do "extra" work to get some set of data that the mobile view never rendered.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload