Entity Framework Tutorial - Second Edition
eBook - ePub

Entity Framework Tutorial - Second Edition

  1. 274 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Entity Framework Tutorial - Second Edition

About this book

A comprehensive guide to the Entity Framework with insight into its latest features and optimizations for responsive data access in your projectsAbout This Book• Create Entity data models from your database and use them in your applications• Learn about the Entity Client data provider and write statements in Entity SQL to perform CRUD operations• Explore ADO.NET Data Services and how they work with the Entity FrameworkWho This Book Is ForIf you are a C# developer who wants to learn a new way of querying data and utilizing it in applications efficiently for data binding or other operations, then this book is for you. Basic knowledge of ADO.NET is assumed.What You Will Learn• Explore the features of the ADO.NET Entity Framework• Understand the concepts of entities and their relationships• Create an Entity Data Model using the ADO.NET Entity Data Model Designer and the EdmGen tool• Extend existing Entity Types to create your own Entity Types• Write programs against the Entity Data Model to perform CRUD operations• Discover ADO.NET Data Services and learn how they can be used with the Entity Framework• Familiarize yourself with WCF Data Services (formerly ADO.NET Data Services)• Apply Code First, Model First and Database First approachesIn DetailThe ADO.NET Entity Framework from Microsoft is a new ADO.NET development framework that provides a level of abstraction for data access strategies and solves the impedance mismatch issues that exist between different data models.This book explores Microsoft's Entity Framework and explains how it can used to build enterprise level applications. It will also teach you how you can work with RESTful Services and Google's Protocol Buffers with Entity Framework and WCF. You will explore how to use Entity Framework with ASP.NET Web API and also how to consume the data exposed by Entity Framework from client applications of varying types, i.e., ASP.NET MVC, WPF and Silverlight. You will familiarize yourself with the new features and improvements introduced in Entity Framework including enhanced POCO support, template-based code generation, tooling consolidation and connection resiliency. By the end of the book, you will be able to successfully extend the new functionalities of Entity framework into your project.Style and approachThis book is a step-by-step tutorial providing hands-on code examples with detailed explanations. The book aims to explain the concepts of the Entity Framework and illustrate how you can use these in applications with a tutorial based approach.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Entity Framework Tutorial - Second Edition by Joydip Kanjilal in PDF and/or ePUB format, as well as other popular books in Informatica & Programmazione in C#. We have over one million books available in our catalogue for you to explore.

Information

Entity Framework Tutorial Second Edition


Table of Contents

Entity Framework Tutorial Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Introducing the ADO.NET Entity Framework
What you should know
Looking back
What is the ADO.NET Entity Framework?
Is Entity Framework just another ORM?
A comparative analysis of Entity Framework and other ORM tools
LINQ to SQL and .dbml files
Entity Framework architectural components
The Entity Data Model
How is the EDM represented?
The Object Model (O-Space)
LINQ to Entities
Entity Client
Entity SQL
Avoiding complex joins
The Object Services Layer
Features and benefits at a glance
System requirements
Support for persistence ignorance
Support for T4 code generation
Support for lazy loading
Support for POCO change tracking
Better n-tier support with self-tracking entities
Support for code-first, model-first, and database-first approaches
Support for built-in functions and UDF support
Support for model-defined functions
Enum support
Spatial data types support
Other enhancements
Performance improvements in Entity Framework 6
New features in Entity Framework 7
Summary
2. Getting Started
Designing the UserAuthentication database
Creating the EDM
Creating the Entity Data Model using the ADO.NET Entity Data Model Designer
Creating Entity Data Model using the EdmGen tool
The DataSource controls
The ObjectDataSource control
The SqlDataSource control
The SiteMapDataSource control
The XMLDataSource control
The LinqDataSource control
The EntityDataSource control
Implementing our first application using the Entity Framework
Summary
3. Entities, Relationships, and the Entity Data Model
Entities, entity types, and relationships in the EDM
What is an entity?
Defining entity sets in the EDM
Extending the existing entity types to create derived entity types
Association sets, associations, containment, and multiplicity
What are entity containers?
Exploring the Security EDM
The Mapping Details window
The Entity Model browser
The EDM layers
The CSDL schema
The SSDL schema
The MSL schema
Entity classes
Summary
4. Working with Stored Procedures in the Entity Data Model
Creating a database using model-first development
Creating stored procedures
Mapping stored procedures to functions in the EDM
Mapping the create, update, and delete functions to entities in the EDM
Mapping stored procedures with no entity set
Executing stored procedures using the EDM
Mapping stored procedures that return custom entity types
Summary
5. Working with Entity Client and Entity SQL
An overview of the E-SQL language
From T-SQL to E-SQL
Why E-SQL when I already have LINQ to Entities?
Features of E-SQL
Operators in E-SQL
Arithmetic operators
Comparison operators
Logical operators
Reference operators
Type operators
Set operators
Operator precedence
Expressions in E-SQL
Query expressions in E-SQL
Identifiers, variables, parameters, and types in E-SQL
Row
Collections
Reference
Canonical functions in E-SQL
Mathematical functions
Aggregate functions
String functions
Bitwise functions
Date and time functions
Data paging using E-SQL
Working with the ADO.NET Entity Client
Let's get into action
Building the connection string
Creating an entity connection
Opening the connection
Executing queries using the entity command
Closing the connection
Other operations with E-SQL
Inserting a record using E-SQL
Inserting a record with a foreign key constraint
Retrieving native SQL from EntityCommand
Transaction management in E-SQL
Deferred, eager, and lazy loading
Summary
6. Working with LINQ to Entities
Introducing LINQ
Why LINQ?
Understanding the LINQ architecture
LINQ to XML
LINQ to SQL
LINQ to Objects
LINQ to Entities
Querying data using LINQ to Entities
LINQ to Entities and Entity Framework
Differences between LINQ to Entities and LINQ to SQL
Parallel LINQ
Operators in LINQ
Aggregation
Projections
Ordering
Quantifiers
Restriction
Conversion
Element
Set
Querying data using LINQ
Expressions in LINQ to Entities
Constant expressions
Comparison expressions
Initialization expressions
Null comparisons
Navigation properties
Immediate and deferred query execution
Retrieving entity data from the Security database
Summary
7. Working with the Object Services Layer
What are Object Services?
Features at a glance
The SecurityDbEntity's DbContext class
Querying data as in-memory objects
Using Entity Framework 7
Performing CRUD operations on objects
Attaching and detaching objects to and from ObjectContext
Serializing and deserializing entity instances
Change tracking and identity resolution using ObjectContext
Understanding the code-first, model-first, and database-first approaches to domain design
Using the code-first approach
Using the model-first approach
Using the database-first approach
Inheritance in Entity Framework
Table-per-Hierarchy
Table-per-Type
Table-per-Concrete Type
Implementing complex types in the EDM
State management, identity management, and relationship management
Reading objects from the Security database
Inserting objects from the Security database
Editing objects from the Security database
Deleting objects from the Security database
Summary
8. Working with WCF Data Services
Introducing WCF Data Services
How do WCF Data Services and Web Services differ?
What is Repres...

Table of contents

  1. Entity Framework Tutorial Second Edition