Partial Classes - Identical Signatures

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?
 
G

Guest

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.
 

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