Using Static methods or none static methods in Dao Class ?
Posted
by dankyy1
on Stack Overflow
See other posts from Stack Overflow
or by dankyy1
Published on 2010-03-26T14:05:14Z
Indexed on
2010/03/26
14:23 UTC
Read the original article
Hit count: 463
Hi I generate Dao classes for some DB operations
in this manner making methods of Dao class as static or none static is better?
Using sample dao class below ,If more than one client got to use the AddSampleItem method in same time?how this may result?
public class SampleDao
{
static DataAcessor dataAcessor
public static void AddSampleItem(object[] params)
{
dataAcessor =new DataAcessor();
//generate query here
string query="..."
dataAcessor.ExecuteQery(query);
dataAcessor.Close();
}
public static void UpdateSampleItem(object[] params)
{
dataAcessor =new DataAcessor();
//generate query here
string query="..."
dataAcessor.ExecuteQery(query);
dataAcessor.Close();
}
}
© Stack Overflow or respective owner