473,406 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Custom Business objects question

I'm creating a lot if custom business objects. They work better, faster and
lighter than using table adaptors. Totally cool so far except for one thing i
just thought of: destructors. I've searched for this a little and can not
find a good answer as to whether or not to create them nor how to use them. I
kill all my datareaders (like a good boy should!), but i'm starting to get
concerned about these custom objects and lists of objects i'm creating.

1. I'm doing asp.net if it makes a difference
2. i get the impression that they just die when they go out of scope.
3. if they do die when out of scope can the garbage collector be told to
free up.
space now?
4. It's worth noting that all my created object are dumb objects that do not
include methods. Methods are in other classes. This does make them light, so
should i be worried?
Thanks
--
Share The Knowledge. I need all the help I can get and so do you!
Jun 27 '08 #1
2 1044
1. I'm doing asp.net if it makes a difference

Not really; the main things that make a difference are whether you are
talking to unmanaged resources, such as handles or COM. If you aren't
doing this, you don't need a finalizer (aka destructor, but finalizer
is the official term for .NET). If you *were* holding an expensive
resource, then IDisposable would be a good idea, but you don't it just
for domain entities (data classes).
2. i get the impression that they just die when they go out of scope.
They become eligible for garbage collection (assuming you haven't
linked them somewhere). When they are collected is non-deterministic,
but if they are short-lived (typical for ASP.NET) they will be in
"generation zero", where they can be collected very efficiently;
the .NET garbage collector assumes that most objects are short-lived,
and is designed to exploit this.
3. if they do die when out of scope can the garbage collector be told to
free up*space now?
Yes, but don't. Let the GC alone - it knows what it is doing.
4. It's worth noting that all my created object are dumb objects that do not
include methods. Methods are in other classes. *This does make them light, so
should i be worried?
That doesn't make them any lighter or heavier in terms of memory usage
- so this isn't an issue.

Marc
Jun 27 '08 #2
appreciated
--
Share The Knowledge. I need all the help I can get and so do you!
"Marc Gravell" wrote:
1. I'm doing asp.net if it makes a difference

Not really; the main things that make a difference are whether you are
talking to unmanaged resources, such as handles or COM. If you aren't
doing this, you don't need a finalizer (aka destructor, but finalizer
is the official term for .NET). If you *were* holding an expensive
resource, then IDisposable would be a good idea, but you don't it just
for domain entities (data classes).
2. i get the impression that they just die when they go out of scope.

They become eligible for garbage collection (assuming you haven't
linked them somewhere). When they are collected is non-deterministic,
but if they are short-lived (typical for ASP.NET) they will be in
"generation zero", where they can be collected very efficiently;
the .NET garbage collector assumes that most objects are short-lived,
and is designed to exploit this.
3. if they do die when out of scope can the garbage collector be told to
free up space now?

Yes, but don't. Let the GC alone - it knows what it is doing.
4. It's worth noting that all my created object are dumb objects that do not
include methods. Methods are in other classes. This does make them light, so
should i be worried?

That doesn't make them any lighter or heavier in terms of memory usage
- so this isn't an issue.

Marc
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: womber | last post by:
I am getting XML from a dataset that has been populated via a storedprocedure no schemas have been applied nor any relationships. But the correct table names have been given to match the table(s)...
0
by: Michael Rodriguez | last post by:
I have a custom business object collection based on the CSLA.NET framework from Rockfor Lhotka's "Expert C# Business Objects" book. I bound my winform to the object and when I open the screen the...
2
by: headware | last post by:
I am new to 3-tiered design and am in the process of designing an application that will work with ASP.NET as well as Windows Forms (and possibly with a PDA of some sort down the road). My question...
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
8
by: Techno_Dex | last post by:
Has anyone come up with a slick way to make Custom Serializable Objects to behave like DataSets when using WebServices? What I'm looking for is some way to force the WSDL generated code to create...
5
by: David Palau | last post by:
I'm looking for some guidance on what data type would work best as the result output of a web service function method. This web method will return an object that implements a class that is...
0
by: ntalkos | last post by:
Hi all. I am developing a custom business object model, consisting of 2 objects, Question and Answer. One Question can have many possible Answers. So, the Answer class has a public property called...
5
by: Simon Woods | last post by:
Hi Does anyone know if there any dotnet software out there which converts a dataset into a collection of custom objects, programmatically i.e. actually creates the class structure and collection...
1
by: =?Utf-8?B?VGVycnk=?= | last post by:
I am brand new to using Crystal Reports and am trying to generate a report based on a custom object - in another project. I have a layered design, with all my business objects in a seperate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.