0

I am currently writing a web application in ASP.NET MVC, so far it is mostly a simple CRUD web app. The database is hosted on the cloud and I am using Entity Framework to interact with it.

I know that further in the development cycle we will have to make a mobile application (iOS with swift) which will interact with the same database, so I want to have a good framework that will be able to handle both without too much duplication of code or DAL, while still being secure.

Those are the options I have so far:

  • Write my MVC web application and further down the line, make http requests to my controllers action from my app. Possible problems: Security and authentications of those calls?
  • Write my MVC web application and a MVC Web API. Both my controllers of my web app and the iOS app will interact with this API. Possible problems: Will this setup work with the asp.net MVC web app?
  • Write additional web methods in my MVC controllers specifically for the REST api call of my iOS app. Possible problems: Is it possible at all?
-3

The best way for iOS to communicate with your database is with REST (or JSON). So your third option is the best. Your .NET web application can easily also include web service commands that allow the JSON iOS app Set and Get the data.

  • 2
    Sure, but why is REST or JSON best? – user22815 Oct 6 '15 at 1:56
  • Steve Jobs decided that direct connections with internet based databases was not secure, so they did not allow iOS to create direct database connections with anything other then local sqllite. So if you are using a cloud based database, a web service is your only choice for iOS. – ideaztech Oct 6 '15 at 2:07
  • 2
    A web service can be accomplished quite easily with option 2, so why is option 3 better? – Robert Harvey Oct 6 '15 at 2:51
  • Actually your 2nd and 3rd options are very similar. You will want to make both your web app and iOS app interact with the same web service as you noted in option 2. But in order to be iOS compatible, you will likely want to use REST standards as you noted in option 3. I guess the underlining question is: Will your iOS app require REST? That is the usual standard, but depending on your development environment and developer, you may not need to use REST. – ideaztech Oct 6 '15 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.