943,808 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 1047
  • ASP.NET RSS
Jan 7th, 2009
0

Static methods in DataLayer

Expand Post »
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.
--------------
asp.net Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
koppv0 is offline Offline
2 posts
since Jan 2009
Jan 7th, 2009
0

Re: Static methods in DataLayer

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.
Reputation Points: 31
Solved Threads: 7
Light Poster
iDeveloper is offline Offline
49 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: How to draw a Binary Tree Dynamically from Database, in ASP.NET C#
Next Thread in ASP.NET Forum Timeline: How to Create Excel File(.xls) from VB.Net App





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC