471,337 Members | 1,025 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Dataset class in VS2008

AMP
Hello,
I click on Add Data Source and go through all the dialog boxes and
what I get is a class with a bunch of partial classes. I get that.
What I dont understand is why much of the code shows up many times.
I have included a snippet below. You dont have to read it...but this
gets repeated EXACTLY in every partial class.
There are over 10,000 lines in this IDE created class and it looks
like most of it is just repeated.
But I'm not sure, thats why I'm asking.
Thanks,
Mike
Ex:internal global::System.Data.SqlClient.SqlConnection Connection {
get {
if ((this._connection == null)) {
this.InitConnection();
}
return this._connection;
}
set {
this._connection = value;
if ((this.Adapter.InsertCommand != null)) {
this.Adapter.InsertCommand.Connection = value;
}
if ((this.Adapter.DeleteCommand != null)) {
this.Adapter.DeleteCommand.Connection = value;
}
if ((this.Adapter.UpdateCommand != null)) {
this.Adapter.UpdateCommand.Connection = value;
}
for (int i = 0; (i < this.CommandCollection.Length); i
= (i + 1)) {
if ((this.CommandCollection[i] != null)) {
((global::System.Data.SqlClient.SqlCommand)
(this.CommandCollection[i])).Connection = value;
}
}
}
}
Jun 27 '08 #1
1 1089
On May 1, 8:41*am, AMP <ampel...@gmail.comwrote:
Hello,
I click on *Add Data Source and go through all the dialog boxes and
what I get is a class with a bunch of partial classes. I get that.
What I dont understand is why much of the code shows up many times.
I have included a snippet below. You dont have to read it...but this
gets repeated EXACTLY in every partial class.
Hi,

Well the code you posted makes all the sense in the world, it appear
that the class (and I assume all the others too) have a DataAdapter as
a member and a property named Connection, that when it's set it update
all the connections of the commands of the DataAdapter.

I see no problem there.

Maybe if all the classes inherit from a common base and the above
functionality is implemented there then you (or the framework) do not
have to generate it so many times.

But again, I see no problem with that. I do not think you will end
with a much bigger code for that.
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by DaveINOPS | last post: by
20 posts views Thread by Iouri | last post: by
4 posts views Thread by BillE | last post: by
3 posts views Thread by =?Utf-8?B?SmFtZXMgV29uZw==?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.