Reputation: 717
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?
Upvotes: 0
Views: 368
Reputation: 16066
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:
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.
Upvotes: 1