Atjaunināt sīkdatņu piekrišanu

E-grāmata: Pro Entity Framework Core 2 for ASP.NET Core MVC

3.92/5 (25 ratings by Goodreads)
  • Formāts: PDF+DRM
  • Izdošanas datums: 18-Apr-2018
  • Izdevniecība: APress
  • Valoda: eng
  • ISBN-13: 9781484234358
  • Formāts - PDF+DRM
  • Cena: 88,63 €*
  • * ši ir gala cena, t.i., netiek piemērotas nekādas papildus atlaides
  • Ielikt grozā
  • Pievienot vēlmju sarakstam
  • Šī e-grāmata paredzēta tikai personīgai lietošanai. E-grāmatas nav iespējams atgriezt un nauda par iegādātajām e-grāmatām netiek atmaksāta.
  • Formāts: PDF+DRM
  • Izdošanas datums: 18-Apr-2018
  • Izdevniecība: APress
  • Valoda: eng
  • ISBN-13: 9781484234358

DRM restrictions

  • Kopēšana (kopēt/ievietot):

    nav atļauts

  • Drukāšana:

    nav atļauts

  • Lietošana:

    Digitālo tiesību pārvaldība (Digital Rights Management (DRM))
    Izdevējs ir piegādājis šo grāmatu šifrētā veidā, kas nozīmē, ka jums ir jāinstalē bezmaksas programmatūra, lai to atbloķētu un lasītu. Lai lasītu šo e-grāmatu, jums ir jāizveido Adobe ID. Vairāk informācijas šeit. E-grāmatu var lasīt un lejupielādēt līdz 6 ierīcēm (vienam lietotājam ar vienu un to pašu Adobe ID).

    Nepieciešamā programmatūra
    Lai lasītu šo e-grāmatu mobilajā ierīcē (tālrunī vai planšetdatorā), jums būs jāinstalē šī bezmaksas lietotne: PocketBook Reader (iOS / Android)

    Lai lejupielādētu un lasītu šo e-grāmatu datorā vai Mac datorā, jums ir nepieciešamid Adobe Digital Editions (šī ir bezmaksas lietotne, kas īpaši izstrādāta e-grāmatām. Tā nav tas pats, kas Adobe Reader, kas, iespējams, jau ir jūsu datorā.)

    Jūs nevarat lasīt šo e-grāmatu, izmantojot Amazon Kindle.

Model, map, and access data effectively with Entity Framework Core 2, the latest evolution of Microsoft’s object-relational mapping framework that allows developers to access data using .NET objects, and the most common data access layer used in ASP.NET Core MVC 2 projects. 


Best-selling author Adam Freeman explains how to get the most from Entity Framework Core 2 in MVC projects. He begins by describing the different ways that Entity Framework Core 2 can model data and the different types of databases that can be used. He then shows you how to use Entity Framework Core 2 in your own MVC projects, starting from the nuts-and-bolts and building up to the most advanced and sophisticated features, going in-depth to give you the knowledge you need. 

What you’ll learn: 
  • Gain a solid architectural understanding of Entity Framework Core 2
  • Learn how to create databases using your MVC data model 
  • Learn how to create MVC models using an existing database 
  • Learn how to use Entity Framework Core 2 to access data in an MVC application 
  • Learn how to use Entity Framework in RESTful Web Services
Each topic is covered clearly and concisely and is packed with the details you need to learn to be truly effective. The most important features are given a no-nonsense in-depth treatment and chapters include common problems and details of how to avoid them. 

Who this book is for: 

This book is for ASP.NET Core MVC 2 developers who want to use Entity Framework Core 2 as the data access layer in their projects.
About the Author xix
About the Technical Reviewer xxi
Part I: Introducing Entity Framework Core 2 1(202)
Chapter 1 Entity Framework Core in Context
3(4)
Understanding Entity Framework Core
3(1)
About This Book
4(1)
What Do You Need to Know?
4(1)
What Software Do You Need?
4(1)
What If You Don't Want to Use Windows?
4(1)
What Is the Structure of This Book?
4(1)
Part 1: Introducing Entity Framework Core 2
5(1)
Part 2: Entity Framework Core 2 in Detail
5(1)
Part 3: Advanced Entity Framework Core 2
5(1)
Where Can You Get the Example Code?
5(1)
Where Can You Get Corrections for This Book?
5(1)
How Can You Contact Me?
5(1)
Summary
5(2)
Chapter 2 Your First Entity Framework Core Application
7(18)
Getting Ready
7(3)
Installing .NET Core
8(1)
Installing Visual Studio 2017
8(2)
Creating the Project
10(1)
Setting the Scene
10(1)
Creating the Project
11(3)
Creating the Data Model and Context Classes
14(1)
Creating the Controller and Views
15(4)
Configuring Entity Framework Core
19(2)
Configuring the Connection String
20(1)
Configuring the Startup Class
21(1)
Preparing the Database
22(1)
Testing the Application
22(2)
Summary
24(1)
Chapter 3 Working with Databases
25(24)
Preparing for This
Chapter
26(1)
Exploring the Database
27(6)
Examining the Database Tables
29(2)
Examining the Database Content
31(2)
Understanding SQL
33(12)
Querying Data
33(9)
Storing and Updating Data
42(2)
Deleting Data
44(1)
Joining Data
45(2)
Preparing the Database
45(2)
Performing a Join
47(1)
Summary
47(2)
Chapter 4 SportsStore: A Real (Data) Application
49(12)
Creating the Project
49(9)
Configuring the MVC Framework
51(1)
Adding the Model
52(1)
Adding a Repository
52(2)
Adding a Controller and View
54(2)
Adding the Finishing Touches
56(2)
Running the Example Application
58(1)
Summary
59(2)
Chapter 5 SportsStore: Storing Data
61(22)
Preparing for this
Chapter
61(1)
Configuring Entity Framework Core
62(1)
Configuring Entity Framework Core Logging Messages
62(1)
Preparing the Data Model
63(2)
Defining a Primary Key Property
63(1)
Creating the Database Context Class
63(1)
Updating the Repository Implementation
64(1)
Preparing the Database
65(4)
Configuring the Connection String
65(1)
Configuring the Database Provider and Context Class
66(2)
Creating the Database
68(1)
Running the Application
69(1)
Avoiding the Query Pitfalls
70(8)
Understanding the IEnumerable T Pitfall
71(2)
Understanding the Duplicate Query Pitfall
73(5)
Common Problems and Solutions
78(4)
Problems Creating or Accessing the Database
78(2)
Problems Querying Data
80(1)
Problems Storing Data
81(1)
Summary
82(1)
Chapter 6 SportsStore: Modifying and Deleting Data
83(22)
Preparing for This
Chapter
83(2)
Modifying Objects
85(14)
Updating the Repository
85(1)
Updating the Controller and Creating a View
86(5)
Updating Only Changed Properties
91(1)
Performing Bulk Updates
92(7)
Deleting Data
99(4)
Common Problems and Solutions
103(1)
Objects Are Not Updated or Deleted
103(1)
The "Reference Not Set to an Instance of an Object" Exception
103(1)
The "Instance of Entity Type Cannot be Tracked" Exception
104(1)
The "Property Has a Temporary Value" Exception
104(1)
Updates Result in Zero Values
104(1)
Summary
104(1)
Chapter 7 SportsStore: Expanding the Model
105(32)
Preparing for This
Chapter
105(2)
Creating a Data Model Relationship
107(9)
Adding a Data Model Class
108(1)
Creating the Relationship
108(1)
Updating the Context and Creating the Repository
109(2)
Creating and Applying a Migration
111(1)
Creating a Controller and View
111(4)
Populating the Database with Categories
115(1)
Using a Data Relationship
116(6)
Working with Related Data
116(2)
Selecting a Category for a Product
118(2)
Creating and Editing Products with Categories
120(2)
Adding Support for Orders
122(11)
Creating the Data Model Classes
122(1)
Creating the Repository and Preparing the Database
123(2)
Creating Controllers and Views
125(6)
Storing Order Data
131(2)
Common Problems and Solutions
133(2)
The "ALTER TABLE conflicted with the FOREIGN KEY" Exception
133(1)
The "UPDATE Conflicted with the FOREIGN KEY" Exception
134(1)
The "The Property Expression x = x name is Not Valid Exception
134(1)
The "Type of Navigation Property name Does Not Implement ICollection OrderLine Exception
134(1)
The "The Property name is Not a Navigation Property of Entity Type name Exception
134(1)
The "Invalid Object Name name Exception
134(1)
Objects Are Deleted Instead of Being Updated
135(1)
The Class Name for Related Data Is Displayed in a View
135(1)
Summary
135(2)
Chapter 8 SportsStore: Scaling Up
137(24)
Preparing for This
Chapter
137(5)
Creating a Seed Data Controller and View
137(5)
Scaling Up Data Presentation
142(13)
Adding Support for Pagination
142(6)
Adding Search and Ordering Support
148(4)
Applying the Data Presentation Features to Categories
152(3)
Indexing the Database
155(4)
Creating and Applying Indexes
157(2)
Common Problems and Solutions
159(1)
Queries for Pages Are Too Slow
159(1)
Applying the Index Migration Times Out
159(1)
Creating an Index Does Not Improve Performance
160(1)
Summary
160(1)
Chapter 9 SportsStore: Customer Features
161(24)
Preparing for This
Chapter
161(6)
Removing the Timing Statements
161(1)
Adding a View Import
162(1)
Modifying the Data Model
162(1)
Adding Product Seed Data
163(3)
Preparing the Database
166(1)
Displaying Products to the Customer
167(7)
Preparing the Data Model
167(2)
Creating the Store Controller, Views, and Layout
169(4)
Testing the Store Display
173(1)
Adding the Shopping Cart
174(9)
Enabling Persistent Session Data
174(3)
Creating the Cart Model Class
177(1)
Creating the Controller and Views
178(5)
Testing the Ordering Process
183(1)
Common Problems and Solutions
183(1)
Clicking a Page Button Manages the Wrong Data Type
183(1)
Clicking a Page Button Has No Effect
184(1)
The "Cannot Insert Explicit Value for Identity Column" Exception
184(1)
Session Objects Are Null
184(1)
Session Objects Are Lost or Inconsistently Available
184(1)
Summary
184(1)
Chapter 10 SportsStore: Creating a RESTful Web Service
185(18)
Preparing for This
Chapter
185(1)
Creating a Web Service
186(12)
Creating the Repository
186(2)
Creating the API Controller
188(2)
Testing the Web Service
190(1)
Projecting a Result to Exclude Null Navigation Properties
190(2)
Including Related Data in a Web Service Response
192(3)
Querying for Multiple Objects
195(3)
Completing the Web Service
198(4)
Updating the Controller
200(2)
Common Problems and Solutions
202(1)
Null Property Values When Storing or Updating Objects
202(1)
Slow Web Service Requests
202(1)
The "Cannot Insert Explicit Value for Identity Column" Exception
202(1)
Summary
202(1)
Part II: Entity Framework Core 2 in Detail 203(260)
Chapter 11 Working with Entity Framework Core
205(34)
Creating the ASRNET Core MVC Project
206(7)
Creating the Data Model Class
207(1)
Configuring Services and Middleware
208(1)
Adding a Controller and View
209(1)
Adding the Bootstrap CSS Framework
210(1)
Configuring the HTTP Port
211(1)
Running the Example Application
212(1)
Adding and Configuring Entity Framework Core
213(10)
Adding the NuGet Package
213(1)
Creating the Database Context Class
214(1)
Preparing the Entity Class
214(1)
Updating the Controller
215(1)
Configuring the Database Provider
216(3)
Configuring Entity Framework Core Logging
219(4)
Implementing the Repository Pattern
223(9)
Defining the Repository Interface and Implementation Class
224(2)
Avoiding the lEnumerable vs IQueryable Pitfall
226(4)
Hiding the Data Operations
230(2)
Completing the Example MVC Application
232(5)
Completing the Repository
233(1)
Adding the Action Methods
234(1)
Updating and Adding Views
235(2)
Summary
237(2)
Chapter 12 Performing Data Operations
239(26)
Preparing for This
Chapter
240(2)
Starting the Example Application
241(1)
Reading Data
242(10)
Reading an Object by Key
242(4)
Querying All Objects
246(1)
Querying for Specific Objects
247(5)
Storing New Data
252(2)
Understanding Key Assignment
253(1)
Updating Data
254(8)
Updating a Complete Object
254(2)
Querying the Existing Data Before Updating
256(2)
Updating in a Single Database Operation
258(4)
Deleting Data
262(2)
Summary
264(1)
Chapter 13 Understanding Migrations
265(34)
Preparing for This
Chapter
266(1)
Understanding Migrations
267(7)
Working with the Initial Migration
267(4)
Examining the Migration SQL
271(1)
Applying the Migration
272(1)
Seeding the Database and Running the Application
273(1)
Creating Additional Migrations
274(3)
Adding Another Property to the Data Model
276(1)
Managing Migrations
277(4)
Listing Migrations
278(1)
Applying All Migrations
278(1)
Updating to a Specific Migration
279(1)
Removing a Migration
280(1)
Resetting the Database
281(1)
Working with Multiple Databases
281(5)
Extending the Data Model
282(1)
Configuring the Application
283(2)
Creating and Applying Migrations
285(1)
Managing Migrations Programmatically
286(6)
Creating the Migration Manager Class
286(3)
Creating the Migrations Controller and View
289(2)
Configuring the Application
291(1)
Running the Migrations Manager
291(1)
Seeding Databases Programmatically
292(6)
Creating a Seeding Tool
294(2)
Seeding During Startup
296(2)
Summary
298(1)
Chapter 14 Creating Data Relationships
299(34)
Preparing for This
Chapter
300(1)
Creating a Relationship
300(12)
Adding a Navigation Property
301(1)
Creating the Migration
302(2)
Querying and Displaying the Related Data
304(4)
Updating the View to Display Related Data
308(2)
Preparing the Database
310(2)
Creating and Updating Related Data
312(6)
Creating a New Supplier When Creating a New Product
314(2)
Updating a Supplier when Updating a Product
316(2)
Deleting Related Data
318(3)
Creating a Required Relationship
321(6)
Creating a Foreign Key Property
321(2)
Dropping the Database and Preparing the Seed Data
323(1)
Updating and Seeding the Database
324(1)
Understanding the Required Relationship Delete Operation
325(2)
Querying for Multiple Relationships
327(4)
Updating and Seeding the Database
328(1)
Querying the Chain of Navigation Properties
329(2)
Summary
331(2)
Chapter 15 Working with Relationships Part 1
333(38)
Preparing for This
Chapter
333(1)
Directly Accessing Related Data
334(9)
Promoting Related Data
335(3)
Accessing Related Data Using a Type Parameter
338(5)
Completing a Data Relationship
343(10)
Querying Related Data in a One-to-Many Relationship
344(9)
Working with Related Data in a One-to-Many Relationship
353(16)
Updating Related Objects
355(3)
Creating New Related Objects
358(4)
Changing Relationships
362(7)
Summary
369(2)
Chapter 16 Working with Relationship Part 2
371(32)
Preparing for This
Chapter
371(1)
Completing a One-to-One Relationship
372(3)
Defining the Navigation Property
372(1)
Selecting the Dependent Entity Class
373(1)
Creating and Applying the Migration
374(1)
Working with One-to-One Relationships
375(14)
Querying Related Data in a One-to-One Relationship
375(2)
Creating and Updating Related Objects
377(3)
Changing One-to-One Relationships
380(9)
Defining Many-to-Many Relationships
389(13)
Creating the Junction Class
390(1)
Completing the Many-to-Many Relationship
391(1)
Preparing the Application
392(2)
Querying for Many-to-Many Data
394(3)
Managing Many-to-Many Relationships
397(5)
Summary
402(1)
Chapter 17 Scaffolding an Existing Database
403(28)
Preparing for This
Chapter
404(12)
Understanding the Example Existing Database
404(1)
Connecting to the Database Server
405(1)
Creating the Database
405(6)
Creating the ASRNET Core MVC Project
411(4)
Testing the Example Application
415(1)
Scaffolding an Existing Database
416(7)
Performing the Scaffold Process
416(3)
Using a Scaffolded Data Model in the ASRNET Core MVC
419(4)
Responding to Database Changes
423(5)
Modifying the Database
424(1)
Updating the Data Model
425(1)
Updating the Context Class
426(1)
Updating the Controllers and Views
426(2)
Adding Persistent Data Model Features
428(2)
Summary
430(1)
Chapter 18 Manually Modeling a Database
431(32)
Preparing for This
Chapter
432(1)
Creating a Manual Data Model
432(19)
Creating the Context and Entity Classes
433(1)
Creating the Controller and View
434(2)
Understanding the Basic Data Model Conventions
436(1)
Overriding the Data Model Conventions
437(6)
Modeling Relationships
443(6)
Completing the Data Model
449(2)
Using the Manually Created Data Model
451(10)
Querying Data in a Manually Created Data Model
452(3)
Updating Data in a Manually Created Data Model
455(6)
Summary
461(2)
Part III: Advanced Entity Framework Core 2 463(184)
Chapter 19 Working with Keys
465(32)
Preparing for This
Chapter
466(9)
Creating the Data Model
467(1)
Creating the Controller and Views
468(3)
Configuring the Application
471(3)
Creating the Database and Testing the Application
474(1)
Managing Key Generation
475(4)
Understanding the Identity Strategy
475(1)
Understanding the Hi-Lo Key Strategy
476(3)
Working with Natural Keys
479(8)
Ensuring Unique Values for Natural Keys
480(2)
Creating an Alternate Key
482(5)
Using Natural Keys as Primary Keys
487(3)
Creating Composite Keys
490(5)
Summary
495(2)
Chapter 20 Queries
497(30)
Preparing for This
Chapter
498(2)
Managing Change Tracking for Query Results
500(5)
Removing Individual Objects from Change Tracking
502(1)
Changing the Default Change Tracking Behavior
503(2)
Using a Query Filter
505(7)
Overriding a Query Filter
509(3)
Querying Using Search Patterns
512(3)
Making Asynchronous Queries
515(3)
Explicitly Compiling Queries
518(2)
Avoiding the Client Evaluation Pitfall
520(5)
Throwing a Client Evaluation Exception
523(2)
Summary
525(2)
Chapter 21 Storing Data
527(36)
Preparing for This
Chapter
528(3)
Specifying SQL Data Types
531(5)
Specifying a Maximum Length
533(1)
Updating the Database
534(2)
Validating or Formatting Data Values
536(7)
Avoiding the Backing Field Selective Update Pitfall
539(4)
Hiding Data Values from the MVC Application
543(3)
Accessing Shadow Property Values
544(1)
Including Shadow Properties in Queries
545(1)
Setting Default Values
546(5)
Displaying the Default Value
548(3)
Detecting Concurrent Updates
551(11)
Using Concurrency Tokens
552(5)
Using a Row Version to Detect Concurrent Updates
557(5)
Summary
562(1)
Chapter 22 Deleting Data
563(26)
Preparing for This
Chapter
563(5)
Understanding Delete Constraints
568(3)
Configuring the Delete Behavior
570(1)
Using the Cascade Delete Behavior
571(2)
Setting Foreign Keys to Null
573(8)
Relying on the Database Server to Change Foreign Keys
574(2)
Relying on Entity Framework Core to Update Foreign Keys
576(5)
Taking Control of the Delete Operation
581(2)
Re-creating the Cascade Behavior
581(1)
Re-creating the Set Null Behavior
582(1)
Reinstating the Soft-Delete Feature
583(4)
Summary
587(2)
Chapter 23 Using Database Server Features
589(40)
Preparing for This
Chapter
590(4)
Using SQL Directly
594(17)
Querying Using SQL
594(13)
Calling Stored Procedures or Other Operations
607(4)
Using Server-Generated Values
611(17)
Using Database Server-Generated Default Values
611(5)
Incorporating Sequential Values
616(3)
Computing Values in the Database
619(4)
Modeling Automatically Generated Values
623(5)
Summary
628(1)
Chapter 24 Using Transactions
629(18)
Preparing for This
Chapter
630(3)
Understanding the Default Behavior
633(5)
Performing Independent Changes
634(2)
Disabling Automatic Transactions
636(2)
Using Explicit Transactions
638(7)
Including Other Operations in a Transaction
640(2)
Changing the Transaction Isolation Level
642(3)
Summary
645(2)
Index 647
Adam Freeman is an experienced IT professional who has held senior positions in a range of companies, most recently serving as chief technology officer and chief operating officer of a global bank. Now retired, he spends his time writing and long-distance running.