Which ORM tools have you worked with?
sobes.tech AI
Answer from AI
I have worked with several ORMs in the .NET ecosystem:
-
Entity Framework (EF) and Entity Framework Core (EF Core): These are the most common ORMs I have used. I employed them in various projects working with SQL Server, PostgreSQL, and SQLite databases. I have experience with both Code First and Database First approaches. I have worked with migrations, LINQ queries, managing entity relationships, and performance tuning.
using (var context = new ApplicationDbContext()) { var users = context.Users .Where(u => u.IsActive) .ToList(); // Example of a simple LINQ query } -
Dapper: Although Dapper is a micro-ORM, I actively used it in projects where high performance was required or more flexible control over SQL queries was needed. It was often used for reading data, while EF was used for write operations and entity management.
using System.Data; using Dapper; using Microsoft.Data.SqlClient; // Example for SQL Server public class UserRepository { private readonly string _connectionString; public UserRepository(string connectionString) { _connectionString = connectionString; } public IEnumerable<User> GetActiveUsers() { using (IDbConnection db = new SqlConnection(_connectionString)) { // Example of using Dapper to execute a raw SQL query return db.Query<User>("SELECT * FROM Users WHERE IsActive = 1").ToList(); } } }
EF Core is my primary ORM for new projects due to its modern design, cross-platform capabilities, and extensive features. Dapper is used in cases requiring maximum performance or direct SQL control.