//DAL:
class UserDao
{
DataContext context;
public UserDao(DataContext context)
{
this.context=context;
}
public void CreateUser(User user)
{
context.Users.Add(user);
context.SubmitChanges();
}
}
//BLL:
class UserRules
{
DataContext context;
public UserRules(DataContext context)
{
this.context = context;
}
public CreateUser(string name, bool isFemale, string qqNo)
{
User user = new User(...);
new UserDao(context).CreateUser(user);
//do other stuff needed by bl when creating user
}
}
//UI
DataContext context = new DataContext(connectionString);
UserRule rule = new UserRule(context);
rule.CreateUser(...);