What is custom object

  • Thread starter Thread starter TonyJ
  • Start date Start date
T

TonyJ

Hello!

Can somebody explain what custom object means which is mentioned in the text
below.

The alternative to using DataSets is to create custom object types that
represent your business entities, and custom collection types to contain
them. When you go this route, you end up needing to write a lot more code
yourself. This has gotten a lot better in Visual Studio 2005 and .NET 2.0
with the additions of code snippets and generic collection classes. But to
support the full range of features that a DataSet provides, there is still a
fair amount of custom code that you will need to write by hand.



//Tony
 
public class Customer {
public int Number {...}
public string Name {...}
...etc...
}

Note that the entity approach is well suited to ORM tools like LINQ
and NHibernate, and makes it easier to expose the entities as fully-
defined types for web-services etc. DataSet uses an adapter pattern;
advantages to both. Personally I prefer an entity approach as it feels
a lot more object oriented. And I'm a control freak.

Marc
 
TonyJ said:
Hello!

Can somebody explain what custom object means which is mentioned in the text
below.

The alternative to using DataSets is to create custom object types that
represent your business entities, and custom collection types to contain
them. When you go this route, you end up needing to write a lot more code
yourself. This has gotten a lot better in Visual Studio 2005 and .NET 2.0
with the additions of code snippets and generic collection classes. But to
support the full range of features that a DataSet provides, there is still a
fair amount of custom code that you will need to write by hand.

The custom object type would be a class that represents a record in the
data table, and has properties that correspond to the fields in the
table. The custom object would contain the same data as a DataRow does
in the DataSet.
 
Here is a blog entry, with downloadable code:

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!140.entry

I have a 1.1 version of this article as well, which I would look at too.

I have a comparison between strong datasets and custom objects... and you
might be surprised by the time it takes to load them.
See 1.1 example for more info.



PS

These days, I go ahead and define a collection object like this

public class OrderCollection : List<BusinessObjects.Order>
{
//yeah, that's all there is to it.
}

You'll know what I"m talking about if you download and go through the code.
 
Back
Top