Business layer, Service layer and 3-tier architecture -


i want obtain 3-tier architecture: ui<-bll<-dal.

my dal "super" object can handle different db tecnologies sql server, mysql, ecc..

and think business logic layer:

/// <summary> /// customer entity /// </summary> public class account {     public string username;     public string email; }   public class accountservice<t>     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...         // write  account 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 have questions this:

  • is example of business layer or service layer or what?
  • it correct validate input in business logic?
  • in register method, account created? correct created in ui layer (read value input form, create account object , pass register)?
  • is correct bll can access db through entitymanager?
  • i need other layers if think build client , web gui using kind of bll?

you can achieve support multiple rdbms technology implementing repository pattern i.e. set of common interfaces each rdbms data access components can implement.

your business logic isolated separate class if not expose them via boundary i.e. using soap or rest, don't have service layer. not every application needs service layer. depend on requirements , projected future growth of system.

validation can challenging. if inputs system ui, validation in ui should sufficient. however, if have service layer, may need replicate of validations business layer well.

you may want refer article better view on layered architecture http://serena-yeoh.blogspot.com/2013/06/layered-architecture-for-net.html

you can download sample implementations here http://layersample.codeplex.com/


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -