Partial Classes - Identical Signatures

  • Thread starter Thread starter daokfella
  • Start date Start date
D

daokfella

I want to extend the auto-generated tableadapter classes created by
the dataset designer.

I'd like to add a connectionString property so I can set this outside
my class library. I've got Get/Set code for that in my partial class.

Is it possible to "REPLACE" method calls in a partial class? In other
words, I'd like to replace the InitConnection() Sub in the generated
class with my own in my partial class.

I basically want to change the original in the auto-generated code:

Private Sub InitConnection()
Me._connection = New System.Data.SqlClient.SqlConnection
Me._connection.ConnectionString =
Global.FVE.DAL.My.MySettings.Default.MyConnectionString
End Sub

To This in my partial:

Private Sub InitConnection()
Me._connection = New System.Data.SqlClient.SqlConnection
If m_ConnectionString = Nothing Then
Me._connection.ConnectionString =
Global.FVE.DAL.My.MySettings.Default.MyConnectionString
Else
Me._connection.ConnectionString = m_ConnectionString
End If
End Sub

Is this possible? Or should I just init the _connection variable in my
ConnectionString Set?
 
I want to extend the auto-generated tableadapter classes created by
the dataset designer.

I'd like to add a connectionString property so I can set this outside
my class library. I've got Get/Set code for that in my partial class.

Is it possible to "REPLACE" method calls in a partial class? In other
words, I'd like to replace the InitConnection() Sub in the generated
class with my own in my partial class.

To replace amethod you're better off inheriting the class.
 
Back
Top