E-Book, Englisch, 345 Seiten
Rouleau Beginning Entity Framework Core 2.0
1. ed
ISBN: 978-1-4842-3375-7
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
Database Access from .NET
E-Book, Englisch, 345 Seiten
ISBN: 978-1-4842-3375-7
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
Use the valuable Entity Framework Core 2.0 tool in ASP.NET and the .NET Framework to eliminate the tedium around accessing databases and the data they contain.
Entity Framework Core 2.0 greatly simplifies access to relational databases such as SQL Server that are commonly deployed in corporate settings. By eliminating tedious data access code that developers are otherwise forced to use, Entity Framework Core 2.0 enables you to work directly with the data in a database through domain-specific objects and methods.
Beginning Entity Framework Core 2.0 is a carefully designed tutorial. Throughout the book you will encounter examples that you can use in your day-to-day coding, and you will build a solid foundation on which to create database-backed applications. If you are looking for a way to get started without getting buried under details you are only going to forget, then this is the book for you.
The author aims to leave you comfortably able to connect to, access, modify, and delete data from a relational database. The book provides a clear, straightforward approach and includes code that you can look back at months later and understand.
What You'll LearnStudy easy-to-follow, real-world examples you can use every day
Focus on DbContext and the Database First approach
Understand how to work with single and multiple tables
Use the LINQ query language to manipulate dataWho This Book Is For
C# and ASP.NET programmers looking for an easier way of accessing data in a relational database than writing in SQL-a way that meshes better into object-oriented application development
?Derek J. Rouleau is a Computer and Information Systems Manager for a small company in the greater Portland, Maine area. He has been working with computers since the mid 1990's thanks to a friend's father who got him interested in hardware and the workings of the operating system. Derek started professionally programming while working for an educational publishing and software company in the Quality Assurance department. He has been using Visual Basic since VB 6 was out, and C# since 2010. Although he now manages the department where he works, Derek still makes time each week to write code and research new and exciting technologies. When not working, he is involved with Off Track Standardbreds, and he competes in Dressage.
Autoren/Hrsg.
Weitere Infos & Material
1;Table of Contents;5
2;About the Author;9
3;About the Technical Reviewer;10
4;Acknowledgments;11
5;Introduction;12
6;Chapter 1: Getting Started;15
6.1;What Is .NET Core;15
6.2;Setting Up Your Application;16
6.3;Creating the Database and Tables (Entities);17
6.3.1;Creating the Database;33
6.4;Adding Data to a Table;35
6.5;Retrieving Data from a Database and Displaying It;45
6.6;Deleting Data from a Database;47
6.6.1;Deleting a Single Record;47
6.6.2;Deleting Multiple Records;54
6.7;Updating Data in a Table;56
6.8;Summary;59
7;Chapter 2: Working with Multiple Tables;63
7.1;Adding Data to a Table That Has Foreign Keys;64
7.2;Retrieving Data from Multiple Tables;89
7.3;Updating Tables;95
7.3.1;Updating Multiple Records;105
7.4;Summary;109
8;Chapter 3: Stepping Beyond the Basics;110
8.1;Specifying Fields;111
8.2;Joins;114
8.2.1;Left Outer Join;115
8.2.2;Right Outer Join;117
8.2.3;Cross Join;122
8.2.4;Inner Join: Method Syntax;123
8.3;Grouping;125
8.3.1;Query Syntax;125
8.3.2;Method Syntax;127
8.4;Logical Operators;128
8.4.1;Logical OR;132
8.5;Paging and Filtering Results;134
8.6;Concurrency;138
8.7;Summary;143
9;Chapter 4: Data Validation and POCOs;145
9.1;Validation Using DataAnnotations;146
9.1.1;Using Recursion;155
9.2;POCOs;165
9.2.1;Helper Classes;168
9.2.1.1;Expression-Bodied Members;174
9.2.2;Validating Using a Class;180
9.2.2.1;LINQ Using .Any to Check for Existing Records;182
9.2.2.2;Adding a Class to a Class File;184
9.3;Summary;189
10;Chapter 5: Stored Procedures, Table Design, and Modifications;191
10.1;Stored Procedures;191
10.1.1;Calling a Stored Procedure with One Parameter;197
10.1.1.1;Using Parameter Names;199
10.1.1.2;SQL Injection;200
10.1.2;Inserting Into Multiple Tables;201
10.1.2.1;Multiple Properties;203
10.2;Table and Entity Design;204
10.3;Making Changes to the Table;206
10.4;Summary;213
11;Chapter 6: ASP.NET MVC and EF Core 2.0;214
11.1;Setting Up the Application;215
11.2;Database-First Development;218
11.2.1;Creating Controllers and Views;220
11.2.1.1;Formatting Output;224
11.2.2;Page Navigation;225
11.2.3;The Home Page and Adding an Image;227
11.2.4;Error Handling;229
11.2.4.1;Creating a New View to Display an Error;231
11.2.4.2;Avoiding Errors;233
11.2.5;Displaying Events by Location;235
11.2.6;Sorting Results;239
11.3;ASP.NET MVC Basics;241
11.3.1;Strongly Typed Views;243
11.3.1.1;Passing Data to a View Using ViewBag;243
11.3.2;Why Use MVC?;245
11.4;Summary;246
12;Chapter 7: Finishing Our ASP.NET MVC .NET Core 2.0 Project;247
12.1;Data Validation;247
12.1.1;Using a Regular Expression to Validate a Property;251
12.1.2;Validating the Rest of Our Models;253
12.1.2.1;Setting Minimum and Maximum Values for a Property;258
12.2;Adding Column Sorting to Results;262
12.3;Adding Search Capabilities;266
12.4;Adding Pagination: Version 1;272
12.5;Adding Paging: Version 2;280
12.6;Grouping Results;285
12.7;Summary;297
13;Chapter 8: Wrap Up and Where to Go Next;298
13.1;Not Just C# Anymore;298
13.2;Cross Platform;304
13.3;Unit Testing;306
13.4;More on LINQ;321
13.4.1;SQL Server Profiler;324
13.5;Change Tracking;325
13.6;Summary;330
14;Appendix A: Database Script for Chapter 6;331
14.1;Database Diagrams;337
15;Index;340




