Hi, I have declared all the functions in data access layer as static, so that i
need not instantiate a object to access those functions. Will there be any
problem in declaring all the functions as static? Also, will the commonly used
functions returns static value for concurrent users across the application?
Please clarify
pedaammuluPosted Apr 15, 2007, 1:29 PM
more on Static methods:
Static methods act more or less like global methods, in that you can invoke them without actually having an instance of the object at hand. The advantage of static methods over global, however, is that the name is scoped to the class in which it occurs, and thus you don't clutter up the global namespace with myriad function names. This can help manage highly complex programs, and the anme of the class acts very much like a namespace for the static methods within it.
In addition, static methods may be passed instance members as parameters. Because they are scoped to the class, instead of being scoped globally, they have access to tye private members of the instances.
Database programming with VB 2005, C# and SQL Server 2005
Mike GoldPosted Apr 13, 2007, 1:58 PM
You just need to make sure that any member variables and properties used inside the methods are also static or it won't compile.