Book description
Take advantage of the Code First data modeling approach in ADO.NET Entity Framework, and learn how to build and configure a model based on existing classes in your business domain. With this concise book, you’ll work hands-on with examples to learn how Code First can create an in-memory model and database by default, and how you can exert more control over the model through further configuration.
Code First provides an alternative to the database first and model first approaches to the Entity Data Model. Learn the benefits of defining your model with code, whether you’re working with an existing database or building one from scratch. If you work with Visual Studio and understand database management basics, this book is for you.
- Learn exactly what Code First does—and does not—enable you to do
- Understand how property attributes, relationships, and database mappings are inferred from your classes by Code First
- Use Data Annotations and the Fluent API to configure the Code First data model
- Perform advanced techniques, such as controlling the database schema and overriding the default model caching
This book is a continuation of author Julia Lerman’s Programming Entity Framework, widely recognized as the leading book on the topic.
Table of contents
- Preface
-
1. Welcome to Code First
- Modeling with EF Before Code First
- Inception of Code First
- Getting Code First to Developers in Between .NET Releases
- Writing the Code…First
- Managing Objects with DbContext
- Using the Data Layer and Domain Classes
- Getting from Classes to a Database
- Working with Configuration
- Creating or Pointing to a Database
- What Code First Does Not Support
- Learning from This Book
- 2. Your First Look at Code First
-
3. Using Conventions and Configurations for Property Attributes
- Working with Property Attributes in Code First
- Mapping Keys
- Configuring Database-Generated Properties
- Configuring TimeStamp/RowVersion Fields for Optimistic Concurrency
- Configuring Non-Timestamp Fields for Concurrency
- Mapping to Non-Unicode Database Types
- Affecting the Precision and Scale of Decimals
- Working with Complex Types in Code First
- Configuring Properties of Complex Types
- Summary
- 4. Using Convention and Configuration for Relationships
-
5. Using Conventions and Configurations for Database Mappings
- Mapping Class Name to Database Table and Schema Name
- Mapping Property Names to Database Columns
- Allowing Multiple Entities to Map to a Single Table: aka Table Splitting
- Mapping a Single Entity Across Multiple Tables
- Controlling Which Types Get Mapped to the Database
- Understanding Property Mapping and Accessibility
- Preventing Properties from Being Included in the Model
- Mapping Inheritance Hierarchies
- Working with Abstract Base Classes
- Mapping Relationships
- Summary
-
6. Controlling Database Location, Creation Process, and Seed
Data
- Controlling the Database Location
- Working with Database Initialization
- Using Database Initializers to Seed Data
- Using Database Initialization to Further Affect Database Schema
- Summary
- 7. Advanced Concepts
- 8. What’s Coming Next for Code First
- About the Authors
- Copyright
Product information
- Title: Programming Entity Framework: Code First
- Author(s):
- Release date: November 2011
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781449312947
You might also like
book
Modern Software Engineering: Doing What Works to Build Better Software Faster
Improve Your Creativity, Effectiveness, and Ultimately, Your Code In Modern Software Engineering, continuous delivery pioneer David …
book
Deciphering Data Architectures
Data fabric, data lakehouse, and data mesh have recently appeared as viable alternatives to the modern …
book
Code like a Pro in C#
Code Like a Pro in C# teaches you to how write clean C# code that’s suitable …
book
Mobile App Reverse Engineering
Delve into the world of mobile application reverse engineering, learn the fundamentals of how mobile apps …