An Introduction to Entity Framework

Slides:



Advertisements
Similar presentations
Object Relational Mapping – ORM Entity Framework
Advertisements

.NET Database Technologies: Open-Source Frameworks.
Introduction to Database Processing with ADO.NET.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
ORM Technologies and Entity Framework (EF)
Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify.
Introduction to ADO Entity Framework ir Denis VOITURON Source:
C# programming with database Basic guideline. First step Install SQL Server 2008/2010 (Professional edition if possible) Install Visual Studio 2008/2010.
1 Entity Framework Introduction. Outline Goals of Entity Framework 2.
ADO.NET – part II August 2004 [ Marmagna Desai]. CONTENTS ADO vs ADO.NET ADO.NET – Managed providers Connecting to Database SqlConnection Selecting Database.
LINQ Boot Camp ADO.Net Entity Framework Presenter : Date : Mahesh Moily Nov 26, 2009.
Entity Framework, a quickstart Florin−Tudor Cristea, Microsoft Student Partner.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
Intro to C#.net and EF Ilan Shimshoni. The Three Faces of ADO.NET The connected layer – Directly connecting to the DB The disconnected layer – Using datasets.
CS795/895: Introduction. Topics Distributed Systems –Availability –Performance –Web Services Security –Authentication –Authorization –Confidentiality.
.NET Data Access and Manipulation ADO.NET. Overview What is ADO.NET? Disconnected vs. connected data access models ADO.NET Architecture ADO.NET Core Objects.
11 Using ADO.NET II Textbook Chapter Getting Started Last class we started a simple example of using ADO.NET operations to access the Addresses.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL ADO.Net Basics Ruwan Wijesinghe Trainer.
Objectives In this lesson, you will learn to: *Identify the need for ADO.NET *Identify the features of ADO.NET *Identify the components of the ADO.NET.
Module 7: Accessing Data by Using ADO.NET
Object Oriented Software Development 10. Persistent Storage.
Oct * Brad Tutterow. VS 2008.NET 3.5LINQ Entity Framework  The ADO.NET Entity Framework is part of Microsoft’s next generation of.NET technologies.
1.NET Language Integrated Query Yishai Zaltzberg.
1 Avoiding Hacker Attacks. 2 Objectives You will be able to Avoid certain hacker attacks and crashes due to bad inputs from users.
HNDIT Rapid Application Development
Module 4 Introduction ADO.NET.
Entity Framework 7: What’s New? Ricardo Peres Technical Evangelist at Simplifydigital. Microsoft
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 The SqlCommand Object ADO.NET - Lesson 03  Training time: 15 minutes  Author:
.NET Data Access and Manipulation
C Copyright © 2009, Oracle. All rights reserved. Using SQL Developer.
 ADO.NET is an object-oriented set of libraries that allows you to interact with data sources  Commonly, the data source is a database, but it could.
Top 10 Entity Framework Features Every Developer Should Know
Introduction ITEC 420.
DevOps with ASP.NET Core and Entity Framework Core
Introducing the Microsoft® .NET Framework
Introduction to Entity framework
Part 1: Overview of LINQ Intro to LINQ Presenter: PhuongNQK.
ASP.NET Programming with C# and SQL Server First Edition
Introduction to Database Processing with ADO.NET
Introduction to Database Processing with ADO.NET
Introduction to .NET Florin Olariu
Introduction to Entity Framework
5/15/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Relational Model.
Lecture 6 VB.Net SQL Server.
 .NET CORE
Overview of Data Access
Did your feature got in, out or planned?
Entity Framework By: Casey Griffin.
A Tour of EF Core’s Most Interesting & Important Features
Learn. Imagine. Build. .NET Conf
Entity Framework 4 and WCF Data Services 4
ADO.NET Entity Framework
Overview of Data Access
ADO.NEXT Advances in Data Access for 2008
Microsoft Build /15/2018 6:28 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
Web Development Using ASP .NET
Entity Framework Core.
Microsoft Connect /1/2018 2:36 AM
12/3/2018 7:56 PM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
Entity Framework Core (EF Core)
Jeff Webb Maria Baron Chris Hundersmarck
What’s new in ASP.NET Core and Entity Framework 2.2 (Preview 3)
Developing and testing enterprise Java applications
Implementing Entity Framework with MVC Jump Start
M S COLLEGE OF ART’S, COMM., SCI. & BMS Advance Web Programming
Visual Studio 2008.
Entity Framework & LINQ (Language Integrated Query)
Visual Studio 2010 and .NET Framework 4 Training Workshop
.NET Framework V3.5+ & RESTful web services
Presentation transcript:

An Introduction to Entity Framework By Jai Shrivastav

Agenda Life with ADO.Net What is Entity Framework ? Features Version History Approach EF Core

Life with ADO.Net Language C# Sql/MySql Tools Visual Studio Sql/MySql Server Paradigms Object Procedural Common API ADO.Net

Sample ADO.Net Code: using (SqlConnection conn = new SqlConnection("<conn string>")) { conn.Open(); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "sp_SomeProc"; cmd.parameters.AddWithValue("@id", “11"); using (SqlDataReader rdr = cmd.ExecuteReader()) while (rdr.read()) string fname = rdr[“FirstName”].toString(); string lname = rdr[“LastNam”].toString(); } We had to do a repetitive work for connecting with database and do the CRUD operations. And since it is loosely typed so no compile time error if wrong parameter name or error in query syntax.

What is Entity Framework ? Entity Framework is an object-relational mapper (O/RM) that enables .NET developers to work with a database using .NET objects. It eliminates the need for most of the data-access code that developers usually need to write. In other words we can say that it is bridging the gap between objects and relational data

(Business Entities/Domain Classes) UI Business Layer (Business Entities/Domain Classes) Data Layer Entity Framework Database

Features Some features of EF are: Cross Platform – EF Core is a cross-platform framework which can run on Mac, Linux and Windows. Modeling - EF (Entity Framework) creates an EDM (Entity Data Model) based on POCO (Plain Old CLR Object) entities with get/set properties of different data types

Querying - EF allows us to use LINQ queries (C#/VB Querying - EF allows us to use LINQ queries (C#/VB.NET) to retrieve data from the underlying database. EF also allows us to execute raw SQL queries directly to the database. Change Tracking - EF keeps track of changes occurred to instances of your entities (Property values) which need to be submitted to the database. Saving: EF executes INSERT, UPDATE, and DELETE commands to the database based on the changes occurred to your entities when you call the SaveChanges() method. EF also provides the asynchronous SaveChangesAsync() method. Caching: EF includes first level of caching out of the box. So, repeated querying will return data from the cache instead of hitting the database.

Version History EF Version Release Year .Net Framework EF 6 2013 .Net 4.0 & 4.5, VS 2012 EF 5 2012 .Net 4.0 , VS 2012 EF 4.3 2011 EF 4.0 2010 .Net 4.0 , VS 2010 EF 1.0 (or 3.5) 2008 .Net 3.5 SP1, VS 2008 EF Core Version Release Date .Net Framework EF 2.0 Aug 2017 Core 2.0, VS 2017 EF 1.1 Nov 2016 Core 1.1 EF 1.0 June 2016 Core 1.0

Approach Entity Framework Code First DB First Model First

Code First - This approach was introduced with EF 4. 1 Code First - This approach was introduced with EF 4.1. It is mainly useful in Domain Driven Design. In the Code-First approach, you focus on the domain of your application and start creating classes for your domain entity rather than design your database first and then create the classes which match your database design. The following figure illustrates the code-first approach. Model First - In this approach we define your model in an Entity Framework designer then generate SQL, which will create database schema to match your model and then you execute the SQL to create the schema in your database. The classes that you interact with in your application are automatically generated from the EDMX file. DB First - The Database First Approach provides an alternative to the Code First and Model First approaches to the Entity Data Model. It creates model codes (classes, properties, DbContext etc.) from the database in the project and those classes become the link between the database and controller.

EF Core Entity Framework Core is the new version of Entity Framework after EF 6.x. It is open-source, lightweight, extensible and a cross-platform version of Entity Framework data access technology. EF Core is intended to be used with .NET Core applications. However, it can also be used with standard .NET 4.5+ framework based applications. EF Core supports two development approaches 1) Code-First 2) Database-First. EF Core mainly targets the code-first approach and provides little support for the database-first approach because the visual designer or wizard for DB model is not supported as of EF Core 2.0.

THANK YOU!