0

I'm working on a side project where ive decided to expose data with a web api so that when i create the mobile app version of the project I can consume the web services instead of connecting straight to the database.

My questions are: Is this recommended? Will it reduce performance?

I've noticed that now whenever I add new functionality to the NhibernateRepository class I need to create the web api version exposing that data - this takes a little more time.

Also, what about when it comes to more complex queries, shall I just retrieve some of the data straight from the nhibernate queries and some from the web api?

1 Answer 1

1

Well "pulling data" directly from your database server it's a terrible idea, managing your connections / repositories / dao or whatever methodology your using from your mobile app would be a more challenging rather than just talking to a rest service.

some advantages of a rest service:

  • you can put any front end on top of that, that means a web (javascript front end), mobile, tablet , etc.
  • you are reusing your code
  • you are using a thin server approach
  • you are decoupling your code
  • you can send json over the wire, your mobile app will be back-end agnostic, so you'll be able to switch your REST service implementation if you want (moving to another programming language) without refactoring you mobile app

take a look to a architecture design named API first probably by reading that you'll get a bigger picture of what I'm talking about.

performance?

well that's a little bit broad assumption, I wouldn't be too worried about that if you have a good / solid architecture design over a decent relationship between traffic / hardware you will be fine.

I'd suggest for you to take a look on servicestack which is a very nice framework out there with a very nice performance 3.9 is free and from 4.0 is a paid version either way using web API or Servicestack are good options the best that you feel more comfortable.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.