Book Image

Code-First Development with Entity Framework

By : Sergey Barskiy
Book Image

Code-First Development with Entity Framework

By: Sergey Barskiy

Overview of this book

<p>Entity Framework Code-First enables developers to read and write data in a relational database system using C# or VB.NET. It is Microsoft's answer to demand for an ORM from .NET developers.</p> <p>This book will help you acquire the necessary skills to program your applications using Entity Framework. You will start with database configuration and learn how to write classes that define the database structure. You will see how LINQ can be used with Entity Framework to give you access to stored data. You will then learn how to use Entity Framework to persist information in a Relational Database Management System. You will also see how you can benefit from writing ORM-based .NET code. Finally, you will learn how Entity Framework can help you to solve database deployment problems using migrations.</p>
Table of Contents (15 chapters)
Code-First Development with Entity Framework
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Self-test questions


Q1. You cannot get data from a view inside Entity Framework, true or false?

Q2. Which database method can be used to query and retrieve data using SQL statements?

  1. ExecuteSqlCommand

  2. Execute

  3. SqlQuery

Q3. You have to write all SQL Server stored procedures by hand if you want to map CRUD operations for an entity type to a set of stored procedures, true or false?

Q4. There is no downside to using the asynchronous API, true or false?

Q5. Which method can be used to asynchronously save changes in DbContext?

  1. SaveChanges

  2. SaveChangesAsync

  3. SaveChangesAsynchonously

Q6. What method needs to be called to mark a property as a concurrency property inside the entity type configuration class?

  1. RowVersion()

  2. HasDatabaseGenerationOption()

  3. IsRowVersion()

Q7. What exception type indicates a concurrency error?

  1. DbUpdateConcurrencyException

  2. ConcurrencyException

  3. OptimisticConcurrencyException