introduction to entity framework core

this is an introduction to entity framework core. entity framework core, also called ef core is a complete rewrite from the ground up. if you have any experience with previous versions of entity framework, you will find lot of familiar features.

text version of the video
https://csharp-video-tutorials.blogspot.com/2019/04/introduction-to-entity-framework-core.html

healthy diet is very important for both body and mind. we want to inspire you to cook and eat healthy. if you like aarvi kitchen recipes, please support by sharing, subscribing and liking.
https://www.youtube.com/channel/uc7sewixm_yfamyonqcrgfwa/?sub_confirmation=1

slides
https://csharp-video-tutorials.blogspot.com/2019/04/introduction-to-entity-framework-core_20.html

asp.net core text articles & slides
https://csharp-video-tutorials.blogspot.com/2019/01/aspnet-core-tutorial-for-beginners.html

asp.net core tutorial
https://www.youtube.com/playlist?list=pl6n9fhu94yhvkdruslaqsferml_jh4xmu

angular, javascript, jquery, dot net & sql playlists
https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd

what is ef core

ef core is an orm (object-relational mapper).

ef core is lightweight, extensible, and open source software. like .net core, ef core is also cross platform. it works on windows, mac os, and linux. ef core is microsoft’s official data access platform.

what is orm

orm stands for object-relational mapper and it enables developers to work with a database using business objects. as a developer we work with the application business objects and the orm generates the sql that the underlying database understands. in-short, an orm, eliminates the need for most of the data-access code that developers usually need to write.

why use an orm

let's understand, the use of an orm with an example. if we are developing an application to manage employees we would have classes like employee, department etc in our application code. these classes are called the domain classes.

without an orm like ef core, we have to write a lot of custom data access code to store and retrieve employee and department data from the underlying database.

for example to read, insert, update or delete data from the underlying database table we have to write code in the application to generate the required sql statements that the underlying database understands. also when the data is read from the database into our application, we again have to write custom code to map the database data to our model classes like employee, department etc. this is a very common task that we do almost in every application.

an orm like ef core can do all of this for us and saves a lot of time. it sits between our application code and the database. it eliminates the need for most of the custom data-access code that we usually have to write without an orm.

ef core code first approach

ef core supports both code first approach and database first approach. however, with the database first approach there is very limited support in ef core at the moment.

with the code first approach, we first create our application domain classes like employee, customer etc and a special class that derives from entity framework dbcontext class. based on these domain and dbcontext classes, ef core creates the database and relevant tables. out of the box, ef core uses it's default conventions to create the database and database tables. you can change these default conventions if you want to.

ef core database first approach

sometimes we may have an existing database. when we have a database and the database tables already, we use the database first approach. with the database first approach, ef core creates the dbcontext and domain classes based on the existing database schema.

ef core database providers

ef core supports many relational and even non relational databases. ef core is able to do this by using plug-in libraries called the database providers. these database providers are available as nuget packages.

list of ef core database providers
https://docs.microsoft.com/en-us/ef/core/providers/

a database provider, usually sits between ef core and the database it supports. the database provider contains the functionality specific to the database it supports. functionality that is common to all the databases is in the ef core component. functionality that is specific to a database, for example, microsoft sql server specific functionality is with-in the sql server provider for ef core.

we will discuss more about this provider model when we include support for sql server in our asp.net core application in our upcoming videos.

introduction to entity framework core