Static methods in DataLayer

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2009
Posts: 2
Reputation: koppv0 is an unknown quantity at this point 
Solved Threads: 0
koppv0 koppv0 is offline Offline
Newbie Poster

Static methods in DataLayer

 
0
  #1
Jan 7th, 2009
Hi,
i am using the following code in the datalayer. The input paramters are the stored procedure and the associated parameters provided as a HastTable. I am using Enterprise Library, Data Access Block.
--------------
  1. namespace EPD.Data
  2. {
  3. public class DBManager
  4. {
  5.  
  6. static Microsoft.Practices.EnterpriseLibrary.Data.Database dataBase;
  7. static DbCommand oDbCommand;
  8.  
  9. public static CommandResult ExecForScalar(string procName, Hashtable paramValCol)
  10. {
  11.  
  12. CommandResult cmdResult;
  13. try
  14. {
  15. dataBase = Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase();
  16. CommonManager.PrepareCommand(ref dataBase, ref oDbCommand, procName, paramValCol);
  17. cmdResult = CommonManager.BuildResult(dataBase.ExecuteScalar(oDbCommand),
  18. (int)Constant.ResultType.Scalar);
  19.  
  20. }
  21. catch (SqlException ex)
  22. {
  23. cmdResult = CommonManager.BuildResult(ex);
  24. }
  25. catch (Exception ex)
  26. {
  27. cmdResult = CommonManager.BuildResult(ex, (int)ExceptionHandler.ErrorCode.NonSQL);
  28. }
  29. return cmdResult;
  30. }
  31. } }
--------------------------------------------------

I invoke the method from the business layer as follows:
CommandResult result = EPD.Data.DBManager.ExecForScalar("proc", hash table containing the parameters);
Question:
since the basic method is static and need to know if it affects the concurrent users.
Last edited by peter_budo; Jan 11th, 2009 at 2:47 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 49
Reputation: iDeveloper is an unknown quantity at this point 
Solved Threads: 7
iDeveloper iDeveloper is offline Offline
Light Poster

Re: Static methods in DataLayer

 
0
  #2
Jan 7th, 2009
That's a good question. I wonder... given that it would run on different sessions how that would affect anything.
Last edited by iDeveloper; Jan 7th, 2009 at 10:28 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC