Admin Sarwar 1 year ago
admin #dotnet

How do you execute raw SQL queries in Entity Framework?

How do you execute raw SQL queries in Entity Framework?

// Execute raw SQL query

var users = context.Users

  .FromSqlRaw("SELECT * FROM Users WHERE Age > {0}", 18)

  .ToList();


// Execute raw SQL command

var rowsAffected = context.Database

  .ExecuteSqlRaw("UPDATE Users SET IsActive = 1 WHERE Age > {0}", 18);


// For stored procedures

var result = context.Users

  .FromSqlRaw("EXEC GetUsersByAge @Age = {0}", 25)

  .ToList();

0
206

The term 'gcc' is not recognized as the name of a cmdlet, function...

The term 'gcc' is not recognized as the name of a cmdlet, function... C , C++ compiler n...

1723130013.png
Admin Sarwar
1 year ago
Spring Boot Interview Questions

Spring Boot Interview Questions

1723130013.png
Admin Sarwar
1 year ago
SQL Joins Explained: A Beginner-Friendly Guide with Examples, Pitfalls, and Interview Prep

SQL Joins Explained: A Beginner-Friendly Guide with Examples, Pitfalls...

1723130013.png
Admin Sarwar
1 year ago
PLSQL With Oracle JSON Data

PLSQL With Oracle JSON Data

1723130013.png
Admin Sarwar
2 years ago

Kanniloru Minnal

Kanniloru Minnal

1723130013.png
Admin Sarwar
8 months ago