I made WPF application for a client-side and hosting database in a server side ,

I know there is something called REST API to transfer data between a client and server

I don't know this method and also i don't have a time to learn it because the project should finish less than one month,

I am thinking to make client access to database directly by stored procedures.

I don't know if it's safe method or not, if it's not secure what should i do then?....any suggestion please!

  • 4
    You don't have time? So we have free time to give you? What sort of bizarre parallel universe do you live in? – user44761 Mar 15 '18 at 7:04
  • @Tibo Read the question again,i said don't have time to learn API method because the project should finished next month – Ali Waleed Mar 15 '18 at 7:39
  • 5
    Your deadline is not our problem. If you want someone to work to deadline, you should hire a tutor. – kevin cline Mar 15 '18 at 9:04

Yes you need an API.

If your WPF app connects directly to the database server then the users of that app will have the same permissions, and be able to connect to the database themselves and do things that the app would not normally let them do.

You could grant the logged in windows user limited permission to the db, but you will find that the access permissions are not fine grained enough for most apps.

An API allows you to authenticate each user and allow them to only do specific tasks.

If you do not have time to learn a REST technology, perhaps WCF would work for you?

  • You don't necessarily need an API. There are craptons of line-of-business apps that talk directly to the DB and use SQL permissions, and they work "well enough". – whatsisname Mar 16 '18 at 2:08
  • yeah, they work fine untill you need to do a data protection audit – Ewan Mar 16 '18 at 8:00
  • I'm not afraid from a client to be more clear,but I'm afraid from the ISP if he can see th IP Address of my host server and also the username and password of th database ,that is what make me afraid – Ali Waleed Apr 3 '18 at 16:18

Do you need a REST API?

These become useful when you want to publish your data to many client applications. At the moment, you only have one client application so worry about that one. Look into Entity Framework, Linq-to-SQL or even old-school SQL statements and DataSets / DataTables; all of these will probably serve you better, given the short timescale you have to work with.

When you have a need to write a REST API, only then worry about how to do so.

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