Friday, June 20, 2008
Wednesday, June 18, 2008
Role/Importance of Each Layer:
Let's walkthrough this layered architecture by using an example of Employee Management Service.
- Data Access Layer (DAL)
This layer plays the role of communicating with the data sources through an adapter/connector. It's built in such a way that it can communicate with disparate data sources like AX, SAP or for that matter any other data source like SQL, ORACLE etc.
E.g. We have Dynamics AX .Net Business Connector which directly communicates with Dynamics AX. In our employee management scenario, DAL has methods like ConnectToAX which will talk to AX via the AX Business Connector using the logon mechanism and retrieve the data from AX.
- Business Logic Layer (BL)
This layer will NOT communicate directly with the data source by any means. It has to place the request through DAL which in turn will retrieve the data from data source and return the data objects.
E.g. In our employee management service example, the BL layer will have a method say, GetEmpDetails which will invoke GetEmpDetails method of DAL Layer which in turn will talk to AX and retrieve the data in a container object (i.e. array) and return it to BL Layer.
Note: Here, we have an business entity object called Employee which will be used by BL layer to populate the Employee object's members like FirstName, LastName etc and this will be returned as an object to the next layer.
- Web Service Layer (WSL)
This layer ONLY communicates with the BL Layer and it will do the act of serializing the Entity Object into XML Document so that it can be used by the presentation layer.
E.g. In our employee management service example, the BL Layer returns the populated Employee Entity Object to WSL Layer and the WSL Layer uses XMLSerialization to serialize the object into XMLDocument which in turn is returned to the presentation layer.
- Presentation Layer (PL)
This layer is what the end-users interact with. It's also known as the GUI part. It can ONLY communicate with the Web Service Layer. It can be in form of Windows Client, a Sharepoint Team Site, Web application or a smart client.
E.g. In our above example, it will interact with the Web Service Layer and it will deserialize the XMLDocument back into Employee object so that it can be used in the GUI controls.
Note: Business Entity Object, in the above example Employee Object is shared by Business Logic Layer, Web Service Layer and Presentation Layer. It's this object which is transported across these layers.