Recently I’ve started following a pre-existing project based on ASP.NET 3.5.
Now, I have to say that I’ve kinda avoided the old ASP.NET until now (I fall in love with the neat style of MVC), and this is also the first time I’m working without EF and SQL Server.
I have to query against an OracleDB and the way this is done in other sections of the project is similar to this:
private DbDataReader InjectQuery(string query)
{
DbCommand command = connection.CreateCommand();
command.CommandText = query;
command.CommandTimeout = 0;
return command.ExecuteReader();
}
Is this the best possible way to execute a query? Should I use a different approach?
P.S. I was quite uncertain if this question was better suited for Code Review. It seems to me a direct question about a technology than a revision, so I chose Stack Overflow instead. If I was wrong point it out for me please.
Thank you.
Yep, it is still best practice if you don’t want to use data access frameworks like EF, NHibernate and etc.