Derive from DataTable

J

Joe

I need to make a custom DataTable which has columns that inherits from
DataColumn and rows which inherit from DataRow. I would ideally like to have
my own DataColumnCollection and DataRowCollection so we don't need to keep
casting from a System.Data.DataRow or System.Data.DataColumn to our own.

Since neither collection class can be inherited from and both the Columns
and Rows property of the DataTable cannot be overridden I don't see a way to
do what I want.
In addition, the indexer of DataRow also cannot be overridden.

Any suggestions on what to do in this case?

Thanks,
Joe
 
K

Kevin Yu [MSFT]

Hi Joe,

Yes, we cannot override these properties and inherit from
DataColumnCollection class. Could you let me know how you need to customize
the DataTable, so that I might give some ideas? Is the current column not
meeting your requirements?

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
J

Joe

Kevin,

We need to add a lot of properties to a DataColumn to make it more like a
business object. As for the DataRow, our "values" could possibly have 2
values. If value1 is not null I want to return it otherwise the normal value
will be returned.

-Joe
 
K

Kevin Yu [MSFT]

Hi Joe,

In this case, I suggest you create your own classes for your business
objects. Also, create your own collection which derives from
CollectionBase, if needed. Otherwise, you can use an array instead.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
K

Kevin Yu [MSFT]

Hi Joe,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top