locked
3-Tier Architecture with BLL, DAL Help needed RRS feed

  • Question

  • User197122282 posted

    Hi Experts,

    I am learning the 3-Tier architecture and have been puzzled by a couple of things. I want some clarification on a few things:

    1. Business Entities (BEs) represent real life entities like customer, order. Microsoft now emphasises on using Generics for strong type data transfer amongst layers. This requires DAL to return a strongly typed list to the BLL. This means that DAL also need to refer to the BEs defined in the BLL. According to my understanding and Microsoft's recommended approach (as depicted in Pet Shop 4.0 Application in the BEs are defined in the Model Project which is referenced by DAL, Business Components and Presentation Tier), all three layers will include a reference of BEs.  Kindly let me know, if i have understood this concept my Microsoft correctly, I mean the BEs are referenced by all three layers (otherwise i dont see how they can pass strongly typed data to each other) ?

    2. BEs are classes including Constructors and Properties. Due to my inexperience, i can understand constructors working but i have not yet seen any usage of the properties and hence find them of no use specially using Intellisence (i know im wrong). Kindly make me understand their usage. I am well aware of OO Concepts but i just want to clarify my concepts in the new 3-Tier Scenario.

    3. Can any1 be kind enough to give me a working short code example in which we pass data from DAL to BAL and vice versa. I would like to see how a complete object is passed from layers to layer and how the BEs come into play. Please do give me a short code example. I will be very obliged.

    4. What are Business Objects/Components and how do they interact with the DAL. Are they also responsible for actually performing the business rules and responsible for Data transfer between DAL and Presentation Tier.

    5. Is there any good code example of 3-Tier Architecture using Generics on the Net which can be used using VWD Express and SQL Express ?

    Thanx for your time...

    kashifdotnet

    Thursday, October 12, 2006 7:54 AM

Answers

  • User-389939489 posted
    Hello kashifdotnet:

    > 1. Kindly let me know, if i have understood this concept my Microsoft correctly, I mean the BEs are referenced by all three layers

    I don't know the applications you mention. Anyway, about architecture in general, I think you have the concept right.

    > 2. BEs are classes including Constructors and Properties. ... I am well aware of OO Concepts but i just want to clarify my concepts in the new 3-Tier Scenario.

    Sorry, I don't understand your question here. Constructors and properties are OO general concepts not specifically related to layering/tiering...

    > 3. Can any1 be kind enough to give me a working short code example in which we pass data from DAL to BAL and vice versa.

    Here is a tutorial with custom objects and generics: http://www.codeproject.com/aspnet/CustomBusinessObjects.asp

    > 4. What are Business Objects/Components and how do they interact with the DAL. Are they also responsible for actually performing the business rules and responsible for Data transfer between DAL and Presentation Tier.

    Yes, the are responsible for performing the business rules. No, they act on entities rather than trasfer data.

    > 5. Is there any good code example of 3-Tier Architecture using Generics on the Net which can be used using VWD Express and SQL Express ?

    See the link above.

    Another recent and very dense thread, to read some more on this, is here: http://forums.asp.net/thread/1421761.aspx

    Hope this can be a starting point. -LV

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 12, 2006 10:29 AM
  • User1695803477 posted
    Persistance is basically how you save the state of a BE. Think about it, your BE won't be able to stay in memory FOREVER, it needs to be stored in a persistant medium like a hard disk or such. Usually, this is your data layer, the lowest layer of your application that is responsible for serializing BEs to and from a persistant medium such a database, xml file, flat file, etc...
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 16, 2006 10:49 AM

All replies

  • User-389939489 posted
    Hello kashifdotnet:

    > 1. Kindly let me know, if i have understood this concept my Microsoft correctly, I mean the BEs are referenced by all three layers

    I don't know the applications you mention. Anyway, about architecture in general, I think you have the concept right.

    > 2. BEs are classes including Constructors and Properties. ... I am well aware of OO Concepts but i just want to clarify my concepts in the new 3-Tier Scenario.

    Sorry, I don't understand your question here. Constructors and properties are OO general concepts not specifically related to layering/tiering...

    > 3. Can any1 be kind enough to give me a working short code example in which we pass data from DAL to BAL and vice versa.

    Here is a tutorial with custom objects and generics: http://www.codeproject.com/aspnet/CustomBusinessObjects.asp

    > 4. What are Business Objects/Components and how do they interact with the DAL. Are they also responsible for actually performing the business rules and responsible for Data transfer between DAL and Presentation Tier.

    Yes, the are responsible for performing the business rules. No, they act on entities rather than trasfer data.

    > 5. Is there any good code example of 3-Tier Architecture using Generics on the Net which can be used using VWD Express and SQL Express ?

    See the link above.

    Another recent and very dense thread, to read some more on this, is here: http://forums.asp.net/thread/1421761.aspx

    Hope this can be a starting point. -LV

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 12, 2006 10:29 AM
  • User197122282 posted

    Hi Julio,

     Thanks for your reply. Let me further explain my thoughts:

    > I don't know the applications you mention. Anyway, about architecture in general, I think you have the concept right:

    Here i am talking about Microsoft Pet Shop 4.0. In this application, Microsoft has defined Business Entities in a seperate project known as Model. This assembly is than referenced in all three layers. I think that is understandable since if we dont have common business entities to be shared amongst all three layers, how can they really transfer strongly typed data amongst each other. To my understanding, the BEs are apart and defined within the Business Layer (seperate from Business Objects) but they are referenced in all 3 layers (am i right).

     > Sorry, I don't understand your question here. Constructors and properties are OO general concepts not specifically related to layering/tiering...

    Well i have seen numerous examples. e.g. When a DAL creates a list of strongly typed objects, it initiates an object (using BE) for every record (using the constructor), adds it to the list and finally returns it to the BLL. Similarly the BLL may also create a similar list or an object and pass it on to the DAL for further processing. The same is true for presentation layer working with the BLL. Now my only question is that could you give me a scenario, in which the properties also come into play. I mean how are the properties used within layers. Otherwise, within a BE, only the constructor is enough which creates an entity object. Hope i have made my point clear now.

     > Yes, the are responsible for performing the business rules. No, they act on entities rather than trasfer data.

    Yes i understand what you mean here. Now my question is that if the BE are used to represent the entities and the Business Objects/Components are used for business rules, than which part of the BLL is actually responsible for the data transfer.

    Thanks for the reference code aswell.

    Regards,

    KashifDotNet

    Thursday, October 12, 2006 11:36 AM
  • User197122282 posted

    I also forgot to ask about persistance. What does it really mean. What role do BE play with persistance and how persistance covers the three layers.

     Regards,

    KashifDotNet.

    Thursday, October 12, 2006 11:40 AM
  • User1695803477 posted
    Persistance is basically how you save the state of a BE. Think about it, your BE won't be able to stay in memory FOREVER, it needs to be stored in a persistant medium like a hard disk or such. Usually, this is your data layer, the lowest layer of your application that is responsible for serializing BEs to and from a persistant medium such a database, xml file, flat file, etc...
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 16, 2006 10:49 AM
  • User197122282 posted

    Hi adweigert,

    Thanks a lot for replying. All the guys replying have been of great help to me. As i am new to 3-tier architecture, could you kindly answer a few more questions:

    >> In the BLL, the Business Entities represent the real life entities such as customer, orders while the Business Objects/Components are responsible for managing the business rules. Which part/sub layer of the BLL interacts with the Presentation Tier to pass and get data from it.

     >> If we have to execute a Transaction (such as inserting bulk of rows into the database), which is a better approach 1). Should we start a transaction within the BLL and for each row, call the DAL for execution. or 2). Should we pass the entire rows (in the form of a generic list/dataset) from the BLL to the DAL, which in return will carry out the transaction and process each row.

    >> Microsoft recommends using generics in all tiers, isnt it right that now our BEs will be referenced in all three layers since the generic list is of some Entity Type ?

    Thanks alot for your time. I look forward to your reply,

    Regards,

    KashifDotNet.

    Monday, October 16, 2006 12:36 PM