c# - Should we have stored procedure that internally only call other stored procedure to fetch back result? -


we have created several stored procedures return either true/false basaed on following condition:

(1)isblockedip(ip_address) => return true if input ip_address blocked liftetime. (2)isblockednumber(number) => return true if input number blocked lifetime. (3)isblockediptemp => return true if input ip_address blocked temporarily. (4)isblockednumbertemp => return true if input number blocked temporarily. 

we call these sps our c# applications in several modules. few of these modules need check (1)st condition, few others need check (1)+(3), few others need check (1)+(2)+(4) , few need check (1)+(2)+(3)+(4) , many other combinations these.

what approach (keeping both performance & maintenance in mind):

  1. create separate sps each of these checks i.e. 1,2,3,4 , let client check whichever necessary check in case. example, if client needs check condition (1)+(2)+(4), have make 3 round trips application database server. keep single responsibility each sp @ cost of performance.
  2. create separate sps each of these in above approach create custom sps each requirement calls these sps. i.e. if client needs check condition (1)+(2)+(4), call 1 sp internally call sp (1),(2),(4) , return result in 1 go. take 1 application database server call require additional effort of creating new sps each of these requirements.

which approach better?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -