{"id":1970,"date":"2023-06-05T15:47:44","date_gmt":"2023-06-05T08:47:44","guid":{"rendered":"https:\/\/csharptutorial.net\/?page_id=1970"},"modified":"2023-06-17T16:49:10","modified_gmt":"2023-06-17T09:49:10","slug":"entity-framework-core-tutorial","status":"publish","type":"page","link":"https:\/\/www.csharptutorial.net\/entity-framework-core-tutorial\/","title":{"rendered":"Entity Framework Core Tutorial"},"content":{"rendered":"\n<p>In this Entity Framework Core tutorial series, you will gain proficiency in handling data within your .NET applications. <\/p>\n\n\n\n<p>What you&#8217;ll learn in this tutorial series:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Build your first EF Core application.<\/li>\n\n\n\n<li>Interact with EF core data model.<\/li>\n\n\n\n<li>Control database creation and schema changes via migrations.<\/li>\n\n\n\n<li>Logging SQL and EF Core actions.<\/li>\n\n\n\n<li>Work with relationships like one-to-one, one-to-many, and many-to-many.<\/li>\n\n\n\n<li>Work with raw SQL, views, stored procedures, and other database objects.<\/li>\n\n\n\n<li>Test EF core application.<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Section 1. Getting Started with Entity Framework Core <\/h2>\n\n\n\n<p>This section helps you get started with EF Core by understanding what EF core is, how to start a new .NET app that uses EF Core,  how to create a data model and DB connection, and how to perform a simple CRUD via EF Core&#8217;s API.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/what-is-entity-framework-core\/\">What is Entity Framework Core<\/a> &#8211; a quick introduction to the Entity Framework Core, its features and benefits, and why you should use entity framework core.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/getting-started-with-entity-framework-core\/\">Getting Started with Entity Framework Core<\/a> &#8211; help you get started with the Entity Framework core by setting up a project and installing the required packages and tools.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-log-sql-query\/\">How to log SQL queries in EF Core<\/a> &#8211; show you step by step how to log SQL queries in EF Core.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-migrations\/\">Creating and Applying Migrations<\/a> &#8211; guide you on how to create migrations that capture the changes of the models and apply them to the database.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Section 2. EF Core Relationships<\/h2>\n\n\n\n<p>This section teaches you to understand the representation of relationships in object models and relational database and explain to you how EF Core maps between the two.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-one-to-many-relationship\/\">One-to-many relationships<\/a> &#8211; show you how a single entity associates with zero or more entities.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-one-to-one\/\">One-to-one relationships<\/a> &#8211; learn how to associate an entity with another entity using a one-to-one relationship.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-many-to-many-relationships\/\">Many-to-many relationships<\/a> &#8211; guide you on how to use a many-to-many relationship to associate any number of entities of an entity type with any number of other entities of another entity type.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Section 3. Querying data using LINQ from Entity Framework Core<\/h2>\n\n\n\n<p>This section guides you on how to query data from one or more database tables using both EF Core and LINQ methods:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-sample-project\/\">EF Core Sample Project<\/a> &#8211; download an EF Core Sample Project to create a database and populate data for learning the query.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-select\/\">Select<\/a> &#8211; show you how to select one or more columns using the LINQ Select() method.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-order-by\/\">Order By<\/a> &#8211; learn how to sort data using the LINQ OrderBy(), ThenBy(), OrderByDescending(), and ThenByDescending() methods.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-where\/\">Where()<\/a> &#8211; learn how to filter data using the LINQ Where() method and how to use the AND and OR operator to combine multiple conditions in the Where() method.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-where-in\/\">IN<\/a> &#8211; check if a value matches a list of values using LINQ Contains() method.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-like\/\">LIKE<\/a> &#8211; guide you on how to query data based on pattern matching using the LIKE operator<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-inner-join\/\">Inner join<\/a> &#8211; show you how to use the Include() method to form a query that uses join to get data from two or more tables.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-group-by\/\">Group By<\/a> &#8211; learn how to group rows into groups and apply an aggregate function to each group.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Section 4. Modifying Data<\/h2>\n\n\n\n<p>This section teaches you to create, read, update, and delete entities in EF Core. These operations are known as CRUD:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-insert\/\">Insert<\/a> &#8211; learn how to insert entities into database tables.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-update\/\">Update<\/a> &#8211; show you various ways to update data in database tables.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-delete\/\">Delete<\/a> &#8211; guide you on how to delete data from the database tables.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Section 5. Working with Stored Procedures, Views, and Raw SQL<\/h2>\n\n\n\n<p>This section shows you how to work with stored procedures and views in EF Core.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-stored-procedure\/\">Executing Stored Procedures in EF Core<\/a> &#8211; show you how to execute a stored procedure in EF Core.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/ef-core-views\/\">Querying Data from a Database View<\/a> &#8211; learn how to query data from a database view.<\/li>\n\n\n\n<li><a href=\"https:\/\/csharptutorial.net\/entity-framework-core-tutorial\/executesqlraw\/\">Executing a Raw SQL using the ExecuteSQLRaw() method<\/a> &#8211; show you how to execute a raw SQL using the ExecuteSQLRaw() method and return the number of rows affected.<\/li>\n<\/ul>\n<\/div><\/div>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"1970\"\n\t\t\t\tdata-post-url=\"https:\/\/www.csharptutorial.net\/entity-framework-core-tutorial\/\"\n\t\t\t\tdata-post-title=\"Entity Framework Core Tutorial\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"1970\"\n\t\t\t\tdata-post-url=\"https:\/\/www.csharptutorial.net\/entity-framework-core-tutorial\/\"\n\t\t\t\tdata-post-title=\"Entity Framework Core Tutorial\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this Entity Framework Core tutorial series, you will gain proficiency in handling data within your .NET applications. <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1970","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/pages\/1970","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/comments?post=1970"}],"version-history":[{"count":5,"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/pages\/1970\/revisions"}],"predecessor-version":[{"id":2304,"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/pages\/1970\/revisions\/2304"}],"wp:attachment":[{"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/media?parent=1970"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}