I want to know what Microsoft.Practices.EnterpriseLibrary.Data.dll
is and why we use this assembly.
What are the benefits of this dll?
I want to create a project on 3-tier architecture and am curious on what is the best way for performing sql queries.
Whether I should use this dll or go for simple SqlCommand
and DataAdapter
.
Currently I am working in this way:
(Code in DAL file:)
public void Insert(long id)
{
connection.Open();
SqlCommand dCmd = new SqlCommand("test_procedure", connection);
dCmd.CommandType = CommandType.StoredProcedure;
try
{
dCmd.Parameters.AddWithValue("@id", id);
dCmd.ExecuteNonQuery();
}
catch
{
throw;
}
finally
{
dCmd.Dispose();
connection.Close();
connection.Dispose();
}
}
I am confused whether I am working in a proper way or should if I should better use Microsoft.Practices.EnterpriseLibrary.Data
and work with a DatabaseFactory
.