❔ Entity Framework
Hi! 🙂 So, I know the basics of SQL databases and even have some experience with MSSQL. After completing a C# course, I'm currently on ASP.NET Core 7 course. Is Entity Framework a useful tool? Like, if I want to create some simple projects using databases, will it be helpful, or is it just not an important thing that I could learn after completing the ASP.NET course?
10 Replies
Yes, EF Core is incredibly helpful and used fairly often
so, as i get, i need EF Core 7, not ado.net ef 6
don't mind russian words 🙂
Yes, Entity Framework Core 7 is the newest version of Entity Framework Core
some would argue EF Core overkill, for simple projects, like if you just need basic CRUD operations, but it's very much subjective
things that EF Core can do for you:
A) compile-safe data access. No writing SQL in plaintext and having to actually run it to verify that there's no typos, or that you got all the column names right
or even that you maybe forgot a column
cause you write all your queries in C#
(or whatever .NET language)
and with the latest versions of C#, you get similar extra compile-safety from
required
properties and non-nullable reference type checking
B) the EF Core Designer Toolkit, which mainly consists of the ability to automate like 90% of your migrations workload
if you've ever built a long-term database-based app, you should appreciate the difficulty of doing things like adding or removing table columns, consolidating tables together, or splitting them apart, etc.
generally, the industry-standard approach to this kinda thing is to take your application offline, run pre-defined migration scripts to make the structural changes (without losing data), and then bring the application back online
EF Core allows almost all of this to be automated
the central design requirement of having to "model" all your tables and columns in code means that you already have a framework for the designer to know exactly what the database looks like, and thus be able to (most of the time) generate the code to make schema changes. And with that code in place in .NET, EF Core can also automate the process of deploying these migrations, without needing to take your application fully offline.Ok, I love EF Core. Of course, I realize it's super entry-level, but it was in my roadmap anyway, so sooner or later I'd have to learn it. It turns out to be a super useful and nice thing. I wanted to build a test API but was lazy because of databases with default querys. With EF, that will be super easy
And this reverse engineering thing is 🤯
The usual way to work with EF is in the code-first way
But yeah, reverse-engineering can be useful when you have an existing db
it's also a solid way to introduce yourself to EF, if you're already comfortable with SQL and database management
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.