Re:.NET 5.0
by FridgeSeal on Tuesday November 10, 2020 @05:14PM
(#25052764)
> ASP.NET Core does push you strongly towards dependency injection, but it does not force you at all to use it.
Their own documentation for making queries against SQL Server doesn't provide examples of how to do it that aren't using DI. "Just inject it" it just says. Thanks .net, super helpful. Maybe the docs are there, but I couldn't find them at all when I went looking.
Re:.NET 5.0
by mattmanser on Tuesday November 10, 2020 @07:35PM
(#25054131)
using(var conn = new SqlConnection("<conn-string>"))
using(var cmd = new SqlCommand(@"Query here", conn))
{
conn.Open();
cmd.executeNonQuery();
}
Re:.NET 5.0
by FridgeSeal on Wednesday November 11, 2020 @12:26AM
(#25055735)
Hmmmm, maybe I am just dense hahaha.
ASP.NET Core does push you strongly towards dependency injection, but it does not force you at all to use it.