www.learnentityframeworkcore.com Open in urlscan Pro
40.83.160.29  Public Scan

Submitted URL: http://www.learnentityframeworkcore.com/
Effective URL: https://www.learnentityframeworkcore.com/
Submission: On October 03 via manual from LU — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

Toggle navigation
Learn Entity Framework Core
Your guide to using the latest version of Microsoft's Object Relational Mapper

  EF Core Newsletter
 * Home
   * How To Get EF Core
 * DbContext
   * Adding Data
   * Modifying Data
   * Deleting Data
   * Change Tracker
 * DbSet
   * Querying Data
   * Adding Data
   * Modifying Data
   * Deleting Data
 * Model
   * From Existing Database
   * Shadow Properties
 * Relationships
   * Managing One To Many Relationships
   * Referential Constraint Action Options
 * Conventions
   * One To Many Relationship
   * One To One Relationship
   * Many To Many Relationship
 * Configuration
   * Data Annotation Attributes
     * Column Attribute
     * ComplexType Attribute
     * ConcurrencyCheck Attribute
     * DatabaseGenerated Attribute
     * ForeignKey Attribute
     * Index Attribute
     * InverseProperty Attribute
     * Key Attribute
     * MaxLength Attribute
     * NotMapped Attribute
     * Required Attribute
     * StringLength Attribute
     * Table Attribute
     * Timestamp Attribute
   * Fluent Api
     * Model Configuration
     * Property Configuration
     * HasAlternatekey Method
     * HasColumnName Method
     * HasColumnType Method
     * HasComputedColumnSql Method
     * HasConstraintName Method
     * HasData Method
     * HasDefaultValue Method
     * HasDefaultValueSql Method
     * HasDiscriminator Method
     * HasField Method
     * HasForeignKey Method
     * HasIndex Method
     * HasKey Method
     * HasMany Method
     * HasMaxLength Method
     * HasOne Method
     * HasQueryFilter Method
     * HasValue Method
     * Has/With Pattern
     * Ignore Method
     * IsConcurrencyToken Method
     * IsRequired Method
     * IsRowVersion Method
     * OnDelete Method
     * ToTable Method
     * ToView Method
     * Type Configuration
     * ValueGeneratedNever Method
     * ValueGeneratedOnAdd Method
     * ValueGeneratedOnAddOrUpdate Method
     * WithMany Method
     * WithOne Method
   * One To Many Relationship Configuration
   * One To One Relationship Configuration
   * Many To Many Relationship Configuration
 * Connection Strings
 * Inheritance
   * Table Per Hierarchy
 * Concurrency
 * Migrations
   * Model Snapshot
   * Seeding Data
   * Commands
     * CLI Commands
     * PMC Commands
 * Walkthoughs
   * ASP.NET Core MVC Application
   * .NET Core Console Application
   * Using An Existing Database
 * Raw SQL
 * Database First And Entity Framework Core
 * Query Types
 * Lazy Loading

© 2016 - 2022 - ZZZ Projects.
All rights reserved.

FASTEST ENTITY FRAMEWORK EXTENSIONS

Bulk Insert
Bulk Delete
Bulk Update
Bulk Merge


WELCOME TO LEARN ENTITY FRAMEWORK CORE

This site provides documentation and tutorials for people looking for help with
using Entity Framework Core, Microsoft's recommended data access technology for
applications based on the .NET Core framework.


WHAT IS ENTITY FRAMEWORK CORE?

Entity Framework Core (EF Core) is the latest version of the Entity Framework
from Microsoft. It has been designed to be lightweight, extensible and to
support cross platform development as part of Microsoft's .NET Core framework.
It has also been designed to be simpler to use, and to offer performance
improvements over previous versions of Entity Framework.

EF Core is an object-relational mapper (ORM). Object-relational mapping is a
technique that enables developers to work with data in object-oriented way by
performing the work required to map between objects defined in an application's
programming language and data stored in relational datasources.


WHY USE AN ORM?

Most development frameworks include libraries that enable access to data from
relational databases via recordset-like data structures. The following code
sample illustrates a typical scenario where data is retrieved from a database
and stored in an ADO.NET DataTable so that it is accessible to the program's
code:

using(var conn = new SqlConnection(connectionString))
using(var cmd = new SqlCommand("select * from Products", conn))
{
    var dt = new DataTable();
    using(var da = new SqlDataAdapter(cmd))
    {
        da.Fill(dt);
    }
}


The data within the DataTable is accessible via numeric or string indexers and
needs to be converted from object to the correct type:

foreach(DataRow row in dt.Rows)
{
    int productId = Convert.ToInt32(row[0]);
    string productName = row["ProductName"].ToString();
}


This late-bound or "weakly-typed" approach to data access is prone to error.
Problems commonly arise from mistyping the name of a column, or finding that the
name of the column has been changed in the database, or from a change to the
order in which fields are specified in the SQL statement without a corresponding
change being made to the application code. Equally, data type conversions might
fail. The code will still compile, but will error at runtime. Consequently,
professional developers prefer to work with data in a strongly-typed manner.


STRONG TYPING

When you take a strongly-typed approach to data, you work with properties of
predefined classes that form a domain model in an object-oriented way:

public class Product
{
    int ProductId { get; set; }
    string ProductName { get; set; }
}
int productId = myProduct.ProductId;
string productName = myProduct.ProductName;


Work still needs to be done to retrieve and map the data from the database to an
instance of the domain object. One option is to write your own code to manage
this. However, as the domain model grows, the amount of code required can grow,
and will need more and more development time to maintain. This will increase the
overall amount of time required to complete an application.

ORMs are pre-written libraries of code that do this work for you. Full-featured
ORMs do a lot more too. They can

 * map a domain model to database objects
 * create databases and maintain the schema in line with changes to the model
 * generate SQL and execute it against the database
 * manage transactions
 * keep track of objects that have already been retrieved


NEXT

 * How To Get Entity Framework Core


ON THIS PAGE

 * Welcome To Learn Entity Framework Core
 * What is Entity Framework Core?
 * Why use an ORM?
 * Strong Typing
 * Next




LATEST UPDATES

 * Package Manager Console Commands
 * Command Line Interface commands
 * Commands in Entity Framework Core
 * The Fluent API WithOne Method
 * The Fluent API WithMany Method
 * The Fluent API ValueGeneratedOnAddOrUpdate Method

© 2016 - 2022 - ZZZ Projects.
All rights reserved.