Any differences between Database and SqlDatabase in EntLib3.1

Topics: Building and extending application blocks, Data Access Application Block, General discussion
Apr 16, 2010 at 9:47 PM

Hi! I found myself in need to pass my own connection string to the Data Access Block.

Since CreateDatabase() methods do not take connection string as a paramater I am wandering whether I am going to loose any functionality if I instantiate SqlDatabase directly?

Database db = new Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase(connectionString);

I know that the generic database object does not have the ability to dynamically discover stored procs parameters. Is anything not available in SqlDatabase?


Many thanks in advance,



Apr 17, 2010 at 11:12 PM

All you lose is the ability to change the connection string in configuration, and the (theoretical) ability to change to a non-SQL Server database.

I say theoretical because, in practice, differences between SQL dialects and error handling tends to cause you to write db-specific code regardless.