Join Richard Goforth for an in-depth discussion in this video Why EF Core for an existing database, part of Accessing Existing Databases with Entity Framework Core.
- [Instructor] Lets see why I chose Entity Framework Core for our legacy database. We'll start with the definition of Entity Framework Core from their documentation website. Entity Framework Core is an object-relational mapper that enables .NET developers to work with a database using .NET object. It eliminates the need for most of the data-access code that developers usually need to write. Obviously writing less code is something I always like to do as a developer, but lets talk about what it means to be an object relational mapper. Objects are the language of code and relationships are the language of databases.
Objects are how we organize data in code and relationships are how we organize data in databases. We need to be able to freely flow from relationships to objects and back again to effectively write data centric applications. We need a bridge between the two. You can do this with a lot of code, or a little bit of code. Entity Framework is one way to do this with minimal amount of code. But what makes Entity Framework Core special over other ORMs? Entity Framework has been around for awhile. A lot of previous versions of Entity Framework means that the syntax has had a lot of time to evolve.
But Entity Framework Core is also a complete rewrite of Entity Framework. Allowing the writers of Entity Framework Core to start with a clean slate. But Entity Framework Core has much smarter SQL generation than previous versions of Entity Framework. Entity Framework Core is also open source. Which means that if there's a bug or an issue you can look at the source code. It also means you can contribute to Entity Framework Core yourself if you're so inclined. Finally Entity Framework Core has a wide array of platform options that we talked about in a previous video.
- Setting up your project
- Connecting to a legacy database
- Scaffolding an initial model and context
- Improving the model
- Updating properties and indexes
- Adding concurrency tokens and timestamps
- Creating complex relationships
- Working with non-Microsoft databases such as SQLite and PostgreSQL