locked
Passing Entities to Business Layer RRS feed

  • Question

  • User1448424044 posted

    Hi,

    I am working on implementing a web application in ASP.Net by following the MVC design pattern (Not ASP.Net MVC). As part of the design, we have entity objects that has only properties as per the corresponding table structure and the idea is using these entity objects in the view layer and the same entity objects are passed to Persistence Layer for saving the data to the database. Business Objects in the business layer are responsible for interacting with the database.

    As view creates the entity objects and passes to next layer, what would be the best practice to pass the entity objects to the business layer? Should the business objects accept data objects as parameters and interact with the persistence layer? Is there any other best practice to pass the required objects from the view layer to the next layer? As business objects also need to access the properties of the entity objects passed from the view layer, do we need any "translation" from entity objects to business objects?

    Please suggest the best practices to pass entity objects from view layer to the next layer and also how the entity objects created by the persistence layer can be used by business objects?

    Thanks in Advance.

    Regards,

    Raghu

    Wednesday, March 30, 2011 8:35 AM

Answers

  • User1444272184 posted

    Abstraction means to make the UI layer independent with other layers.The logic and the actual entities are not know to the UI layer and its abstracted under BL itself.For that its require a logical layer between UI & BL called abstraction layer.

    http://www.codeguru.com/csharp/.net/net_general/patterns/article.php/c4673 - refer the details here for the patter through which you can have abstation under your project.

    For the re-usability refer the use of your project modules as a individual functioanlity section like use of your BL into other application etc...

    and Extendability would be refer if you want to add some more entities in a future cource that your solution is enought feasible to incorporate that easily.

    Hope it helps.

    Regards,

    Dharnendra Shah

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 2, 2011 4:09 AM

All replies

  • User1448424044 posted

    Hi,

    Can anybody throw some light and give me direction regarding the question I have posted?

    Thanks in advance,

    Raghu

    Thursday, March 31, 2011 7:07 AM
  • User1444272184 posted

    Hello Raghu,

    Ideally your entity layer would be shared with the presentation layer and the business layer and the communication from the UI layer to Business layer would be the object of the entity.

    Although some of the points which you needs to be take care are
    1.Abstraction
    2.Reusability
    3.Extendibility

    hope it helps.

    Regards,

    Dharnendra Shah

    Thursday, March 31, 2011 8:14 AM
  • User1448424044 posted

    Hello Dharmendra,

    Thank you for your reply. When considering Abstraction are you referring to what fields the View can set to the Entity objects and what it should not set? And do we need to consider Reusability and Extendibility for designing Entity objects as well based on how they are related?

    Also, if one object  is part of another object, like for example Orders associated with a customer; should the entity objects created based on this "has a" relationship?

    Is it possible to share any URLs, if any regarding this on how Entity Objects should be designed and how to use them in the respective layers?

    Thanks in advance,

    Raghu

    Friday, April 1, 2011 7:10 AM
  • User1444272184 posted

    Abstraction means to make the UI layer independent with other layers.The logic and the actual entities are not know to the UI layer and its abstracted under BL itself.For that its require a logical layer between UI & BL called abstraction layer.

    http://www.codeguru.com/csharp/.net/net_general/patterns/article.php/c4673 - refer the details here for the patter through which you can have abstation under your project.

    For the re-usability refer the use of your project modules as a individual functioanlity section like use of your BL into other application etc...

    and Extendability would be refer if you want to add some more entities in a future cource that your solution is enought feasible to incorporate that easily.

    Hope it helps.

    Regards,

    Dharnendra Shah

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 2, 2011 4:09 AM
  • User-1011137159 posted

    In your given structure creaate Enity clases that will communiated with your UI and Bussiness layer. (as of of List if required) and bussiness layer can direcly communicate to dataaccess layer.

    For your enity class also consider relation of each objects (create property of child classes )

    Other apporach:

    At looked at your details structure I would suggest create structure with MVP Model view presenter, there are you just creates an view of your UI layer and create propery of your UI controls and that view is directly can accesss in presenter layer and presentation layer directly communicate to your service layer (business layer).

    http://amitpatelit.wordpress.com/2011/03/06/36/

     

     

     

    Saturday, April 2, 2011 5:07 AM
  • User263675842 posted

    You may use a MVP pattern with a service layer between presentation and BLL.

    Saturday, April 2, 2011 6:22 PM