Auto-generated DataSets

  • Thread starter Thread starter Todd
  • Start date Start date
T

Todd

I have a question about the DataSets/Tables Visual Studio .NET
generates for you when dragging stored procs/tables from the Server
Explorer. The DataSet and DataTable classes created for you have
constructors with an access level of internal (friend in VB.NET). Can
anyone tell me why? To me, you should be able to create a new instance
of the classes anywhere you want.

Thanks,
Todd
 
Todd:

There are many reasons why access levels are in place, and that's basically
to allow creators of objects to determine how they will be used. Many times
there are optimizations built into a class so it will be sealed for
instance. To that end, the assertion that you should be able to create a
new instance of the classes anywhere you want isn't exactly something I'd
agree with.

However, that's not your question. If you drag a Datatable/dataset onto a
form,it's created as friend/internal. That's the default for a lot of
different things the design does. Same thing holds for a button or a text
box. Even if that's declared friend, nothings stopping you from changing it
or declaring an instance of it as Public if need be, but I think
friend/internal is going to cut it in most of the situations you'll need.
Nonetheless, I'm thinking I may have misunderstood your problem so if it
sounds like I did,pleaselet me know.

HTH,

Bill
 
Bill,

First let me thank you for your response. Let me further elaborate on my
question. If I am using these generated data sets in my data layer, but
I want to store them in their own separate assembly, I would need to
have access to their constructors to do so. Agreed? I know I can go in
to the code and change internal to public, but I was just wondering why
it was like that in the first place. And if I would be hurting any part
of the design by changing this.

Thanks again,
Todd
 
Back
Top