Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 10th, 2007, 10:29 AM
Friend of Wrox
 
Join Date: Feb 2006
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Default business object relationships

Should my business object relationships go in both directions? The reason I am unsure is that it seems like it ends up being inefficient at times...

Say I have a Report class, which has a ReportLine collection as one of it's properties. Should ReportLine have a property Report? When I load the ReportLine Collection from Report, I could pass in the Report into the ReportLine constructor and each ReportLine would then be linked to the one Report object in memory.

However if I were to create a ReportLine Collection elsewhere, and then I need to check which Report each line is a member of, I would end up creating one Report object per line in memory, which is what seems inefficient to me...

If anyone has any thoughts on this I'd appreciate the feedback...
 
Old July 11th, 2007, 09:16 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

If you create a report line collection won't those report lines be from the same report? Then the instance of the report should still be shared across all lines in the same way as it would be if the collection is instanced within a report class itself.

-Peter
 
Old July 16th, 2007, 03:02 PM
Friend of Wrox
 
Join Date: Feb 2006
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Peter,

Thanks for that thought.

I failed to mention that sometimes a report lines collection has report lines that always relate to the same report, and sometimes they do not.

I mean, the issue is not one of scalability in my case, but rather of elegant, sensible design. If I call a report line collection on it's own, and I need to iterate through it, and identify what report each line belongs to (each one belonging to a different report), then a report object will be lazy loaded by the Report property of ReportLine one at a time.

I thought about it some more and I think the solution is to create new methods on another object that gets collections that are organized by group differently.

Thanks for your response, I really appreciate it.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Many-to-Many relationships and Business Objects. danielpilon C# 6 May 28th, 2008 09:44 PM
xmlnodelist within a business object ssr92 ASP.NET 2.0 Professional 1 December 23rd, 2007 05:33 AM
1 to 1 relationships scandalous Access 13 January 31st, 2007 12:07 PM
Domain Object inherit from Business Entity case23_69 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 September 25th, 2006 09:48 AM
relationships - why really? pettrer SQL Server ASP 2 August 31st, 2006 12:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.