By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,388 Members | 1,186 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,388 IT Pros & Developers. It's quick & easy.

Need advice on working with coarse-grained objects

P: n/a
I am used to dealing with recordsets and I am using a coarse-grained object
and need to know if I am doing it correctly.

I have a class named Activity which represents an event being planned (golf
outing, dinner dance etc.). The Activity hold a list of Registrations which
represents some company or individual reserving a spot at the activity. The
Registration class holds a list of Attendees which represents the
individuals being registrered for the event. when the Activity is loaded
into memory to be displayed in a form, the activity object data access class
loads the registrations for that activity and the Registration DAL loads the
Attendees into memory. Once the activity is loaded into memory no more data
access occurs. As new registrations are more or new attendees are added,
they are added in memory to the lists of items. When the activity is saved,
the activity writes the registrations back to the table and the registration
writes the attendees back to its table. For an update I delete and insert
all the registrations and attendees for that activity rather than worrying
about updating them.

Is this the proper way to handle a coarse grained object?

Bill

Nov 30 '07 #1
Share this Question
Share on Google+
1 Reply

P: n/a
I wonder why you've chosen a business object model for something that is so
clearly representable using some form of database / datatable.

Perhaps you should reconsider the data model entirely.

To deal with the question in more general terms, business objects in .NET
should implement change notification such as INotifyPropertyChanged. Data
binding can be used to tie the data to a UI and the BindingList<T>
collection class used to store lists of such objects so that list change
notification can be used to update list view and grid objects.

My general philosophy would be to change as little as possible in any one
operation because, as the data grows, you may find that the complexity of
adding and removing many objects for a simple operation becomes a severe
performance bottleneck.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"BillG" <bi*******@charter.netwrote in message
news:C9**********************************@microsof t.com...
>I am used to dealing with recordsets and I am using a coarse-grained object
and need to know if I am doing it correctly.

I have a class named Activity which represents an event being planned
(golf outing, dinner dance etc.). The Activity hold a list of
Registrations which represents some company or individual reserving a spot
at the activity. The Registration class holds a list of Attendees which
represents the individuals being registrered for the event. when the
Activity is loaded into memory to be displayed in a form, the activity
object data access class loads the registrations for that activity and the
Registration DAL loads the Attendees into memory. Once the activity is
loaded into memory no more data access occurs. As new registrations are
more or new attendees are added, they are added in memory to the lists of
items. When the activity is saved, the activity writes the registrations
back to the table and the registration writes the attendees back to its
table. For an update I delete and insert all the registrations and
attendees for that activity rather than worrying about updating them.

Is this the proper way to handle a coarse grained object?

Bill
Dec 1 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.