我正在为我的DAL使用
Linq to sql,并且已经听说过在Web应用程序中使用静态方法的各种事情(关于线程/并发问题).目前,我创建了一个测试DAL,它似乎运行正常.但是,我创建它的方式有什么问题,因为它是静态的吗?
- public static class TestDAL
- {
- public static bool GetUserAddress(string username)
- {
- testDBDataContext dbContext = new testDBDataContext();
- //Linq code goes here
- }
- public static void InsertUserNumber(int userID)
- {
- testDBDataContext dbContext = new testDBDataContext();
- //...
- dbContext.UserDetails.InsertOnSubmit(nUser);
- dbContext.SubmitChanges();
- }
- //etc... All the methods are created in the same way
- }
这种方法适用于Web应用程序,还是生产环境中存在问题?
谢谢.