CosmicCharlie
Programmer
Hello,
I am designing a data tier and I'm trying to implement it using the Abstract Factory design pattern. I want to allow clients to get data as either a DataReader and DataTable as they see fit.
All is well there. However, as I declare the functions that actually return these objects, I can specify a DataTable return value, but the DataReader return value is not available. Instead, I use the IDataReader interface.
Of course, it all comes out in the client code just fine, and I get the DataReader I want. But I am mystified as to why I can declare a DataTable object return value, but for DataReader I must refer to its interface. (IDataTable, by the way, is NOT available.)
Can anyone shed light on this? The simplified code snippet below illustrates my question.
'*************************************************
Public MustInherit Class dalDataReader
Public MustOverride Property ReturnedDataReader() As IDataReader
End Class
Public MustInherit Class dalDataTable
Public MustOverride Property ReturnedDataTable() As DataTable
End Class
'*************************************************
Charlie
I am designing a data tier and I'm trying to implement it using the Abstract Factory design pattern. I want to allow clients to get data as either a DataReader and DataTable as they see fit.
All is well there. However, as I declare the functions that actually return these objects, I can specify a DataTable return value, but the DataReader return value is not available. Instead, I use the IDataReader interface.
Of course, it all comes out in the client code just fine, and I get the DataReader I want. But I am mystified as to why I can declare a DataTable object return value, but for DataReader I must refer to its interface. (IDataTable, by the way, is NOT available.)
Can anyone shed light on this? The simplified code snippet below illustrates my question.
'*************************************************
Public MustInherit Class dalDataReader
Public MustOverride Property ReturnedDataReader() As IDataReader
End Class
Public MustInherit Class dalDataTable
Public MustOverride Property ReturnedDataTable() As DataTable
End Class
'*************************************************
Charlie