M
Michael Lang
This is not a question about ADO.NET, but about implementing .NET
interfaces.
SqlDataAdapter inherits DbDataAdapter and implements IDbDataAdapter
DbDataAdapter inherits DataAdapter and implements ICloneable
DataAdapter inherits Component and implements IDataAdapter
SqlCommand inherits Component and implements IDbCommand and ICloneable
Note: DbDataAdapter does NOT implement IDbDataAdapter
and DataAdapter does NOT implement IDataAdapter
IDbDataAdapter contains:
IDbCommand DeleteCommand{get;set;}
IDbCommand InsertCommand{get;set;}
IDbCommand SelectCommand{get;set;}
IDbCommand UpdateCommand{get;set;}
SqlDataAdapter contains (partial):
SqlCommand DeleteCommand{get;set;}
SqlCommand InsertCommand{get;set;}
SqlCommand SelectCommand{get;set;}
SqlCommand UpdateCommand{get;set;}
I am trying to implement IDbDataAdapter containing (partial):
public class GenDataAdapter: DbDataAdapter, IDbDataAdapter
{ //...Note: same inheritance as SqlDataAdapter... Except 'Component'
GenCommand DeleteCommand{get;set;}
GenCommand InsertCommand{get;set;}
GenCommand SelectCommand{get;set;}
GenCommand UpdateCommand{get;set;}
}
public class GenCommand: IDbCommand{...} // implements IDbCommand...
I get these compile error (similar for each of commands):
'GenDB.Data.GenDataAdapter' does not implement interface member
'System.Data.IDbDataAdapter.UpdateCommand'.
'GenDB.Data.GenDataAdapter.UpdateCommand' is either static, not public, or
has the wrong return type.
Why is this? How does the SqlDataAdapter get around not having each of the
commands return type IDbCommand? Is there some keyword I need to define a
more specific type for the return type than the IDbDataAdapter interface
defines?
interfaces.
SqlDataAdapter inherits DbDataAdapter and implements IDbDataAdapter
DbDataAdapter inherits DataAdapter and implements ICloneable
DataAdapter inherits Component and implements IDataAdapter
SqlCommand inherits Component and implements IDbCommand and ICloneable
Note: DbDataAdapter does NOT implement IDbDataAdapter
and DataAdapter does NOT implement IDataAdapter
IDbDataAdapter contains:
IDbCommand DeleteCommand{get;set;}
IDbCommand InsertCommand{get;set;}
IDbCommand SelectCommand{get;set;}
IDbCommand UpdateCommand{get;set;}
SqlDataAdapter contains (partial):
SqlCommand DeleteCommand{get;set;}
SqlCommand InsertCommand{get;set;}
SqlCommand SelectCommand{get;set;}
SqlCommand UpdateCommand{get;set;}
I am trying to implement IDbDataAdapter containing (partial):
public class GenDataAdapter: DbDataAdapter, IDbDataAdapter
{ //...Note: same inheritance as SqlDataAdapter... Except 'Component'
GenCommand DeleteCommand{get;set;}
GenCommand InsertCommand{get;set;}
GenCommand SelectCommand{get;set;}
GenCommand UpdateCommand{get;set;}
}
public class GenCommand: IDbCommand{...} // implements IDbCommand...
I get these compile error (similar for each of commands):
'GenDB.Data.GenDataAdapter' does not implement interface member
'System.Data.IDbDataAdapter.UpdateCommand'.
'GenDB.Data.GenDataAdapter.UpdateCommand' is either static, not public, or
has the wrong return type.
Why is this? How does the SqlDataAdapter get around not having each of the
commands return type IDbCommand? Is there some keyword I need to define a
more specific type for the return type than the IDbDataAdapter interface
defines?