Last post Dec 22, 2014 07:51 AM by Siva Krishna Macha
Dec 22, 2014 01:56 AM|Rehaan|LINK
I have a class. Inside that class i have one primary method. And i have another 15 methods that i need to check before the primary method executes. The scenario is like this:
The check methods all return true or false. If all are true then the code will execute else no.
Now I have two ways to do this.
1) Write the primary method in wcf and check all the other methods in stored procedure. By this I need to only access the database once. The stored procedure will execute all the functions and if all are true it will return true to execute the rest.
2) I need to write all the methods one by one, multiple stored procedures and here the control will go from wcf to db again and again.
I am confused how to deal with this kind of situation without affecting the performance. Can you please suggest me some better idea how to do it?
Dec 22, 2014 07:51 AM|Siva Krishna Macha|LINK
It looks like you are doing some kind of validation logic. If your validation (or business logic) definitely needs data from DB to accomplish the task, then, hitting the database once and doing all the logic in Stored Procedure makes sense.
Having multiple calls from your application to DB multiple times would result poor performance. So, I would suggest option 1 (single call to DB, all logic in SP) makes sense.