Re: open a db connection in a constructor ?
sloan wrote:
True. But you can only switch database - you can not switch to
XML files or some custom native stuff.
Return a collection of a custom class is a level higher at
the encapsulation scale.
That comes with .NET 2.0 ...
Arne
sloan wrote:
Well, it is the DataAccessLayer , which talks to a database.
>
You notice I return an IDataReader, not a specific one. Thus I can swap it
out to a
SqlDataReader
OracleDataReade r
MySqlDataReader
OleDBDataReader
and it doesn't affect the business layer code at at all.
>
You notice I return an IDataReader, not a specific one. Thus I can swap it
out to a
SqlDataReader
OracleDataReade r
MySqlDataReader
OleDBDataReader
and it doesn't affect the business layer code at at all.
XML files or some custom native stuff.
Return a collection of a custom class is a level higher at
the encapsulation scale.
See my other blog entry "multiple rdbms with the factory pattern" if you
want to see how to have the DAL support multiple databases in a non hacky
fashion.
want to see how to have the DAL support multiple databases in a non hacky
fashion.
Arne
Comment