PC Review


Reply
Thread Tools Rate Thread

dataset and custom classes

 
 
glenn
Guest
Posts: n/a
 
      16th Feb 2005
I have written as a test a customer class that has all the necessary field
handling and formatting routines in it that I need. I have dataaccess class
that controls reading and writing the class into the database. However, I
am now getting to the user interface layer and a little confused as to where
to head next.

What I would like to do is somehow attach my class to a dataset or something
that would make it easy to read and write data into my classes without the
programming having to manually write get and set routines for each and every
field on the form.

Can anyone offer any suggestions as to the best way to handle this? I want
to try to keep my business layer as far away from the UI as possible but
want to provide easy methods for the UI programmers to use when they are
attaching to my classes.

Thanks,

glenn


 
Reply With Quote
 
 
 
 
Dmitriy Lapshin [C# / .NET MVP]
Guest
Posts: n/a
 
      16th Feb 2005
Hi,

What do you mean by field handling and formatting?

Formatting, as a general rule, should be a responsibility of the UI layer,
but not of a business entity object. Handling can mean different things - if
you assume enforcing certain business rules, the business entity object is
the right place.

In general, a kind of rule of thumb I've seen in the Microsoft Patterns and
Practices is - if your business object is merely a data holder, use a typed
DataSet instead. Otherwise, if you encapsulate business rules, validations
or things like that, use a class.

Finally, if your business entity is a custom class, you still can use
databinding. I am not sure this type of databinding is supported in the
Windows Forms designer (probably it is provided you add proper attributes to
the business class' public properties), even if it is not - you can create a
number of DataBinding objects manually to link the class properties to the
controls on the form.

Hope this clarifies things a bit.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"glenn" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I have written as a test a customer class that has all the necessary field
> handling and formatting routines in it that I need. I have dataaccess
> class
> that controls reading and writing the class into the database. However, I
> am now getting to the user interface layer and a little confused as to
> where
> to head next.
>
> What I would like to do is somehow attach my class to a dataset or
> something
> that would make it easy to read and write data into my classes without the
> programming having to manually write get and set routines for each and
> every
> field on the form.
>
> Can anyone offer any suggestions as to the best way to handle this? I
> want
> to try to keep my business layer as far away from the UI as possible but
> want to provide easy methods for the UI programmers to use when they are
> attaching to my classes.
>
> Thanks,
>
> glenn
>
>


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a collection of custom classes in another custom class kagard Microsoft Access 3 12th Jun 2011 07:57 PM
Dataset versus Classes =?Utf-8?B?RGF2aWQgSmVzc2Vl?= Microsoft ADO .NET 2 20th Dec 2004 04:27 PM
DataSet or Classes Ruslan Microsoft ADO .NET 1 16th Jul 2003 02:30 PM
DataSet or Classes Ruslan Microsoft Dot NET 1 16th Jul 2003 02:30 PM
DataSet or Classes Ruslan Microsoft Dot NET Framework 1 16th Jul 2003 02:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:55 AM.