I was using entity framework 6 in my asp.net application and using raw queries like following:
string studentName = ctx.Database.SqlQuery<string>( "Select studentname from Student where studentid=1").FirstOrDefault();
Now I am moving my application to asp.net core, but I could not found raw sql query without using DbSet type.
var students = context.Students .FromSql("Select * from Students where Name = 'Bill'") .ToList();
But this does not solve my solutions.
Is there any extension that developed to run sql queries?
You can use the extension method here to create an ad-hoc DbContext for your type: https://github.com/aspnet/EntityFrameworkCore/issues/1862#issuecomment-451671168