I want to obtain a 3-tier architecture: UI<-BLL<-DAL.
My DAL is a "super" object that can handle different DB tecnologies like sql server, mysql, ecc..
And this is what i think to be the business logic layer:
/// <summary>
/// Customer entity
/// </summary>
public class Account
{
public String Username;
public String Email;
}
public class AccountService<T>
where T : Account
{
IEntitymanager entityManager;
public AccountService(IEntitymanager entityManager)
{
this.entityManager = entityManager;
}
public void Register(T account,
String confirmPw,
String verificationEmailBody)
{
// Validate parameters...
// Check email uniqueness...
// then write account to db...
if (entityManager.Save<T>(account))
{
// Send verification email whit GUID
}
}
public void Verify(String guid)
{
T account = entityManager.Get<T>(new Parameter("Guid", guid));
// Verify account
}
}
Now i have some questions about this:
- Is this an example of business layer or this is a service layer or what?
- It is correct to validate input in business logic?
- In Register method, where account was created? Is it correct that it is created in the UI layer (read value from an input form, create the account object and pass it to Register)?
- Is correct that my BLL can access Db through entityManager?
- I need other layers if i think to build a client and a web GUI using this kind of BLL?