|
-
Jun 30th, 2012, 05:31 AM
#1
[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
-
Jun 30th, 2012, 07:37 AM
#2
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.
-
Jun 30th, 2012, 09:16 AM
#3
Re: Reference and back-reference between Business and Data layers. How to avoid this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|