I was on that road. As recommended by ORM, I would recommend EF Code First. Sorry I'm a little off topic, but I never thought about returning to this template after using EF Code First.
Before Code First, EF was quite painful, but now it is ripe, and if you have a database, you potentially change the structure, that is, a new table or column is required for a new application function, then my approach of EF Code First is my recommendation, If is it another third-party database or a database for another application, then someone else controls its structure, then you need to update your data model only when they are deployed, then I would not use Code First and instead just use the traditional EF, where you generate / update in shu model based on an existing database.
Please note that you can use EF and start using it while you keep the existing code base as is. It depends on how much your infrastructure depends on the use of ADO objects. The EF Power Tools extension allows you to generate the First code model, or you can simply use the traditional non-code first EF to create a modal from the database.
When you want to request, you can qualify for the business of what you are trying to request without having a lot of infrastructure code or wrappers. Another thing about wrappers like the one above is when you have to revert to using the ADO API instead of your RunSqlQuery helper.
This is a trivial example, since I usually don’t have methods like GetActivePeopleNames, but just send the request to where it is needed. Overhead from the point of view of fluffy code is not enough, so impose my request on top of everything else. Although I am implementing some presenter patterns for abstractly transforming queries and data from business logic.
HREntities db = new HREntities(); private ICollection<string> GetActivePeopleNames() { return db.People.Where(p => p.IsActive).Select(p => p.FirstName + " " + p.LastName) .ToList(); }
I did not need to create a parameter object. I could use some variable for Where(p => p.IsActive == someBool) , and that would be safe from SQL injection in this context. The connection is processed automatically. I can use .Include to capture related objects in the same connection, if necessary.