I recently started diving into a new .net core with asp.net core mvc. There were several problems that I encountered, but they managed to get answers to most of them. The one who really alerted me is the use of NPoco.
How should you create a database instance?
The documentation reads:
IDatabase db = new Database("connStringName");
List<User> users = db.Fetch<User>("select userId, email from users");
This is not true for DNXCORE50, since this constructor was excluded for DNCORE50
I also tried to do this:
IDatabase _db = new Database(new SqlConnection(ConnStr));
_db.Single<string>("SELECT Username FROM dbo.Member");
When this code is running, I get a "NullReferenceException"
Does anyone know how to make NPoco work correctly?
source
share