Results 1 to 3 of 3

Thread: [RESOLVED] Reference and back-reference between Business and Data layers. How to avoid this?

  1. #1

    Thread Starter
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Resolved [RESOLVED] Reference and back-reference between Business and Data layers. How to avoid this?

    I've started creating this App with 3 layers, Gui - Business - DataExtraction , everything went fine till now, from business layer I added a reference to the DataExtraction namespace so now the business layer can call methods on the DataExtraction layer, and this DataExtraction layer connects to DB, and then the problem: I need to return a List of instantiated objects of type clsInvoice (this class inherits from abstract Class Document) and clsReceipt, if I add another reference from the DataExtraction layer to the business layer then I would be creating a double reference between both Projects and i understand this is a bad practice, anybody's been in this situation before?

    I've been searching about this problem on Google and it seems many people advice about creating something like empty containers with get/set so the DataExtraction layer has something in the same type that we want the return objects to be, but in my case i inherit these 2 classes (invoice and receipt) from an abstract class, a class with many properties inside, how would I create empty containers from this? This would be almost the same than using the 2 way reference between both layers/projects, .. or maybe not?

    Thanks!
    Last edited by jcis; Jun 30th, 2012 at 06:01 AM. Reason: Added VS Version

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Reference and back-reference between Business and Data layers. How to avoid this?

    You should be defining your entity types in a separate class library that is referenced by both the BLL and DAL.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Reference and back-reference between Business and Data layers. How to avoid this?

    I'll do that, Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width