I have the following Data Access Layer (DAL). I was wondering if it's set up correctly, or if I need to improve it?
public class User
{
}
//Persistence methods
static class UserDataAccess
{
UsersDAL udal = // Choose SQL or FileSystem DAL impl.
InsertUser(User u)
{
// Custom logic , is 'u' valid etc.
udal.Insert(u);
}
}
abstract class UsersDAL
{
GetUserByID();
InsertUser(u);
...
}
// implementaitons of DAL
static class UsersSQLStore : UsersDAL
{
}
static class UsersFileSystemStore : UsersDAL
{
}
I separated the storage layer from the User class to access methods collection which further call any custom DAL.
Is use of static
in DAL implementation correct?
Please suggest corrections or ways I can make this better. I don't have a lot of experience with writing code in layers.