I'm trying to develop a Data Access Layer in .NET, C# to be specific, without the use on entity framework, just ADO.NET. In this case the data is coming from a database.
I'd like to keep the data processing Logic away from the Data Store querying logic. I'm trying to do this to do all my queries via a single method, that takes a SQLCommand, and manages the disposable objects related to the database. I'd like this method to return the data obtained from the query, I could return the Reader object but that'd imply me having to close and dispose of the reader and it's connection on the caller method, and that's exactly what I'm trying to avoid. The other alternative I've come up with is storing each row in a dictionary where the column name is the key, and returning a list of dictionaries back to the caller, this would allow me to close the connection, but I'm not really sure if this is a good way of accomplishing this. I'd like to know if there is a better (proper?) way of doing this.
Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered