22.1 Introduction

A database is an organized collection of data. A database management system (DBMS) provides mechanisms for storing, organizing, retrieving and modifying data. Many of today’s most popular DBMSs manage relational databases, which organize data simply as tables with rows and columns.

Some popular proprietary DBMSs are Microsoft SQL Server, Oracle, Sybase and IBM DB2. PostgreSQL, MariaDB and MySQL are popular open-source DBMSs that can be downloaded and used freely by anyone. In this chapter, we use a version of Microsoft’s SQL Server that’s installed with Visual Studio. It also can be downloaded separately from


https://www.microsoft.com/en-us/server-cloud/products/sql-server-
editions/sql-server-express.aspx

SQL Server Express

SQL Server Express provides many features of Microsoft’s full (fee-based) SQL Server product, but has some limitations, such as a maximum database size of 10GB. A SQL Server Express database file can be easily migrated to a full version of SQL Server. You can learn more about the SQL Server versions at


https://www.microsoft.com/en-us/server-cloud/products/sql-server-
editions/overview.aspx

The version of SQL Server bundled with Visual Studio Community is called SQL Server Express LocalDB. It’s meant for development and testing of apps on your computer.

Structured Query Language (SQL)

A language called Structured Query Language (SQL)—pronounced “sequel”—is an international standard used with relational databases to perform queries (that is, to request information that satisfies given criteria) and to manipulate data. For years, programs that accessed a relational database passed SQL queries as strings to the database management system, then processed the results.

LINQ to Entities and the ADO.NET Entity Framework

A logical extension of querying and manipulating data in databases is to perform similar operations on any sources of data, such as arrays, collections (like the Items collection of a ListBox) and files. Chapter 9 introduced LINQ to Objects and used it to manipulate data stored in arrays. LINQ to Entities allows you to manipulate data stored in a relational database—in our case, a SQL Server Express database. As with LINQ to Objects, the IDE provides IntelliSense for your LINQ to Entities queries.

The ADO.NET Entity Framework (EF) enables apps to interact with data in various forms, including data stored in relational databases. You’ll use the ADO.NET Entity Framework and Visual Studio to create a so-called entity data model that represents the database, then use LINQ to Entities to manipulate objects in the entity data model. Though you’ll manipulate data in a SQL Server Express database in this chapter, the ADO.NET Entity Framework works with most popular database management systems. Behind the scenes, the ADO.NET Entity Framework generates SQL statements that interact with a database.

This chapter introduces general concepts of relational databases, then implements several database apps using the ADO.NET Entity Framework, LINQ to Entities and the IDE’s tools for working with databases. In later chapters, you’ll see other practical database and LINQ to Entities apps, such as a web-based guestbook and a web-based bookstore. Databases are at the heart of most “industrial strength” apps.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset