Introduction
ADO.NET provides a lot of classes for accessing or manipulating data in the database. The use of these classes sometimes becomes repetitive. Imagine you have 5 different methods that perform a retrieval operation. Each method will most likely contain the following procedures:
Create and open a connection object (System.Data.SqlClient.SqlConnection or System.Data.OracleClient.OracleConnection)
Create a command object (System.Data.SqlClient.SqlCommand or System.Data.OracleClient.OracleCommand)
Create and iterate through a data reader object to get the records from the database (System.Data.SqlClient.SqlDataReader or System.Data.OracleClient.OracleDataReader)
With the class library I created, all these repetitive codes are taken care of. At the heart of the class library is the OpenEm.QLite.Database class that hides the initialization of the core components of ADO.NET while also exposing them as an event argument property or as a callback parameter so that developers can still access their properties.
Background
Many of you might already be using an Object-relational Mapping (ORM) tool in your projects. I do too. However, the main reason why I created this class library is because recently, I faced a situation wherein I needed something that is straightforward, gives me full control in writing the SQL statements, and does not hide the mapping between retrieved database records and CLR objects.
ADO.NET provides a lot of classes for accessing or manipulating data in the database. The use of these classes sometimes becomes repetitive. Imagine you have 5 different methods that perform a retrieval operation. Each method will most likely contain the following procedures:
Create and open a connection object (System.Data.SqlClient.SqlConnection or System.Data.OracleClient.OracleConnection)
Create a command object (System.Data.SqlClient.SqlCommand or System.Data.OracleClient.OracleCommand)
Create and iterate through a data reader object to get the records from the database (System.Data.SqlClient.SqlDataReader or System.Data.OracleClient.OracleDataReader)
With the class library I created, all these repetitive codes are taken care of. At the heart of the class library is the OpenEm.QLite.Database class that hides the initialization of the core components of ADO.NET while also exposing them as an event argument property or as a callback parameter so that developers can still access their properties.
Background
Many of you might already be using an Object-relational Mapping (ORM) tool in your projects. I do too. However, the main reason why I created this class library is because recently, I faced a situation wherein I needed something that is straightforward, gives me full control in writing the SQL statements, and does not hide the mapping between retrieved database records and CLR objects.
Read More...
Stay tuned to my blog, twitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.
Stay tuned to my blog, twitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.
No comments:
Post a Comment