Make sure you add using Microsoft.Data.Entity;
because there is an extension method you could use.
var rawSQL = dbContext.SomeModels.FromSql("your SQL");
Even better, instead using raw SQL (at risk of SQL injections attacks) this FromSql method allows you to use parameterized queries like:
dbContext.SomeModels.FromSql("SELECT * FROM dbo.Blogs WHERE Name = @p0", blogName);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…