Lets say I have a UserEntity want to employ a UserEntityManager for all the good things a manager class brings with it. I have a very basic question. Do you think that a
UserManager.AddUser ( ) method should take a UserEntity as parameter or should take the various strings, ints etc that make up the users properties. In other words, have you found this better
public void AddUser(UserEntity newUser)
{
.... do some validation of the entity against more complex business rules and then
add it to the db
newUser.Save()
}
Or have you found this approach more useful
public void AddUser(string userName, string userPassword)
{
UserEntity newUser = new UserEntity();
userEntity.Password=userPassword;
userEntity.UserName = userName;
.... do some validation of the entity against more complex business rules and then
add it to the db
userEntity.Save()
}
The reason I'm asking is because one approach allows Entity objects to reach the PL while the other approach works to avoid that. If I'm interested in having a real facade of some sort, would'nt I pretty much always want the second approach? That way it doesnt matter if a smartphone is calling the code, a winapp or an asp.net page.
Any thoughts?
Thanks,
Thomas