My existing code in MVC4.0 , controller classes action are http based. So it is MVC 4.0 and webapi. However we don't have sperare sercices and controller classes are connecting database context to deal with database operation.
Now, we are looking to make this web application as mobile application. The current website support RWD. Can we use MVC4.0 view to build app? or I have to develop service layer and use some JS framework to call it? I am developing hybrid app using phonegap. We have to leverage existing code.
If we wrap this MVC based code using phonegap will it work in apple appstore and android store
when you develop a hybrid app, you only use HTML, CSS and JavaScript, for your case, you can use the web api controllers like and endpoint and consume it from your hybrid app through ajax.
With hybrid apps, you have great tools and frameworks, one of them is Ionic thats is based on Angularjs (and of course, use apache cordova).
You might want to consider using Xamarin rather than Phonegap. Xamarin has a Razor templating engine that allows you to use .cshtml templates on the client side along with web services. That can result in greater code re-use between your MVC app and your hybrid mobile app. More information here:
Sharper HTML Hybrid Apps with Razor
Related
I am considering using MVC.NET 5 with Entity Framework for the development of a REST API to serve up data for consumption by a few Websites. Is there any compelling reason to wait for MVC.NET 6 or is there a best practice/more common framework for developing REST APIs. The reason I am focused to MVC is so I can enter/edit data via forms that reflect my database to more easily manage my REST data, but I am open to other options if there are more common pursuits.
My front end development is heavily focused towards HTML5 and a few JS libraries such as Angular and Backbone due to the design patterns.
My recommendation is to built a stand alone Web API without mixing it with MVC 5, if you want to do it the right way use OWIN middle ware and add the components needed to build the API.
For the front end and if you are going to build SPA, start new empty project which will hold only your SPA, and this project will talk to your RESTful API.
For sure you need to allow CORS on the back-end API so it will accept calls coming from your SPA.
You can read more about how you structure this on this post. http://bitoftech.net/2014/06/09/angularjs-token-authentication-using-asp-net-web-api-2-owin-asp-net-identity/
I want to start a new project and im not sure, if im using the best setup/approach. The project is kind of a list directory without high computing power needed.
I planned to build an website with Rails Api and AngularJs (+Bootstrap) for normal devices and mobile and use the same api for apps too.
Therefore i planned to use the IonicFramework (+PhoneGap). Is this a common approach or are there any best practices i should consider?
This is the standard way to develop web/desktop apps and mobile apps.
You are approaching this correctly.
Use core AngularJS + Bootstrap for web/desktop app and Ionic
Framework for mobile
Sharing the backend Rails API makes sense. Typically the Rails API
would be designed with REST principles in mind which makes it easier
to consume (probably using Restangular) via web/desktop app and
mobile app
If you follow standard AngularJS conventions to create a separation
of concerns (controllers, services, and views) then you will be able
to share quite a bit of JavaScript code between the web/desktop app
and mobile app and easily override functionality to customize for
devices, if necessary.
I will be starting a PhoneGap application. My skill set includes just MVC framework of .net.
Since I will be making an app for mobile, I believe I wont be able to get benefits of MVC framework for state management, etc or will I?
I guess I will have to use a WCF service for the back end. Or do I need to use something else. How is state management done on HTML5 mobile applications.
Please suggest.
General question:
If I wanted to develop a web site, say ASP.NET MVC (the only web framework I am familiar with), is it generic enough so I can use it to have later apps for iOS, Android, obviously Windows Phone?
I mean I will need to connect somehow to SQL server that is the backend of the ASP.NET MVC web site etc. What are technical difficulties & considerations I need to take into account so that app is generic enough.
Note that I am planning it to be multilingual and will use ASP.NET resources to support that.
Or should I learn completely different framework to have it generic over multiple platforms?
Thanks in advance!
ASP.Net is generic enough. You can expose REST endpoints (although WebAPI is probably better to do that, but you can run that alongside, and consume from, MVC), create full user interfaces, etc.
However, if you are planning a write-once, run-anywhere application to avoid having to develop native device apps (e.g. Android and IOS), make sure to take the time to read this excellent (but long) article.
The MVC framework can definitely be used for mobile devices (when you say apps, I am assuming you mean websites that function as apps), and MVC 4 introduced significantly more support for mobile development, including things like templates (http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253809).
MVC is a move to a less heavy handed framework than, for example, Webforms, and it should give you the flexibility to develop for any device. However, it does also open you up to coding yourself into some problems if you approach it in the wrong way, so make sure you are familiar with the framework before trying to develop some super next-gen responsive web app.
You can expose your ASP.NET MVC controllers to other platforms, like web services or Web API, so the client, IOS, Android or anything else can call your services.
Since Rails uses MVC architecture. I was wondering that if we can use Rails to develop a mobile app or any web app.
Out of MVC the 'M' and 'C' won't change to develop the mobile app right?
I mean the models and controllers will remain the same.
Only the view portion should be changed such that, instead of using html.erb files I want Java or Android SDK or whatever, to provide the UI for the mobile user.
Can someone enlighten me on this perspective?
Also I have been hearing about jRuby does it come into play for our mobile app development requirement?
The answer to this question is going to depend on how you want to deploy this app. Do you want it running completely on the phone or can it be a web app disguised as an iphone/android app?
For the native app solution I'd checkout the Rhodes Framework. It's not RoR but you'll see that it's an MVC framework that feels similar. This will allow you to build native iphone/android apps using Ruby.
For the 2nd option, web app disguised as a mobile app, I'd recommend Sencha Touch. Sencha has done an amazing job mimicking the look and feel of native iphone/android apps with their Javascript library. With this solution it would be just like any other web app though it's targeted for android and iphone via it's UI.
I've created an example rails / ember.js App that is exported with Phonegap. It uses just the usual MVC architecture of a Rails and an Ember.js App. Maybe you will find it useful. It also implements token authentication based on ember-auth and several OAuth strategies.
Currently in de the devel branch: https://github.com/joscas/base_app/tree/devel
Heroku deploy: https://starter-app-staging.herokuapp.com (the desktop version)
Exported with phonegap-rails gem (of which I'm also the author) for assets, fix paths etc.
Absolutly YES!
Ruby on Rails just a backend tech, is the same as what you plan to do for normal browser. There are only two things that you need to consider about mobile app. First is mobile browser's content size because you need to adjust your layout to fit the size. There is a HTML meta tag called viewport can help you.
Ex.
This script will tell user's browser that the content should be fit the devise size,initial-scale defines the viewport rate and maximum-scale defines how many times this page can scale, and user-scalble=0 means user cannot scale the page. More about viewport you can check the Mozilla's doc.
The other thing you need to consider is the HTML5 techs, but actually these aren't problems when you are using jQuery mobile. I recommend you to check their docs. This is very useful and clear for anyone.
RubyonRails is web application framework - it is running on server and user observer the result of application built on RubyOnRails inside browser(or Browser component), despite the fact that you can process on server just "M" from "MVC", and implement "V" and "C" fully on client side( in mobile browser).
In theory, you can fully deploy RubyOnRails application on client side( even RubyOnRails server and etc), but it will be rather expensive and hard, but it is could not be require in any rational project.
assuming:
There are two way you can choose:
Organize RubyonRails application on the server(process there Model), and process "V" and "C" on client side with any proper js libraries.
You can develop Ruby(not RubyOnRails application) - at least it is possible to develop for Android with JRuby.
Yes you can . Your view can be an web page/android/ ios application as view.
You may want to try jQuery Mobile (which is still in alpha by now) if it's just a matter of UI. If you need a tighter integration with your mobile, I don't think that running Rails would be efficient enough.
Try using React Native, the backend technology can still be Ruby while the front-end can use React Native to build mobile app both Android and iOS.
React Native