Follow @RoyOsherove on Twitter

Why are typed data tables columns declared "internal"?

Here's a question that Oskar Austegard left in response to what I wrote ,oh such a long time ago(6 months?), about typed datasets being scalable:

How exactly does one go about using a TDS effectively in a different project, given that the DataColumns are marked as internal?

Say I have the folowing solution with three projects:
* Entities
* Web

If I create all my TDS in the Entities project, how will I be able to reference the DataColumn properties from within the DAL or Web project? This appears to me to be a major drawback of using TDS - at least as VS.NET generates them.



My response:

Hi Oskar. These are declared internal because what you really want to use from external components are the "public" properties that each typed row exposes which are essentially the columns that you are looking for. For example, you should get a CustomersDatatable[rowindex].CustomerName if you want the value for the customer name column for a specific row. you can also get a “regular“ row by doing CustomersDatatable.Rows[rowindex] and casting it to a “CustomersDataRow“ object which will again provide you with all the properties you are looking for.

So why hide the columns themselves? I asked Mike Gunderloy and he came up with a reasonable explanation: To keep all that column access logic in one place (such as null return values and so on). Sounds reasonable to me..


Thanks for your help

Help me rename The Regulator