What's New
This topic contains information about What’s New in the following Entity Framework releases:
What’s New in Entity Framework 5.0 RC
What’s New in Entity Framework 4.3 and 4.3.1
What’s New in Entity Framework 4.2
What’s New in Entity Framework 4.1
Tip: |
|---|
| If you are re-targeting an existing project that references EntityFramework.dll to a different .NET Framework version, you must do the following: uninstall the EntityFramework NuGet package; set the Target Framework value to the .NET Framework version you want; re-install the EntityFramework NuGet package. |
What’s New in Entity Framework 5.0 RC
The following features are new in the Entity Framework 5.0.
-
Ability to map a property to enum data-type. You can use your enum property just like any other scalar property. You can use the Entity Designer within Visual Studio or Code First development to model entities that have properties of enum type. For more information, see Walkthrough: Mapping Enum Types using the Entity Framework Designer.
-
Ability to map a property to Geography and Geometry spatial data-types. You can use these types and methods on these types as part of LINQ queries, for example to find the distance between two locations as part of a query. You can use the Entity Designer within Visual Studio or Code First development to model entities that have spatial data-types properties. For more information, see EF 5.0 Spatial Types Walkthrough.
-
Ability to work with Table-valued functions (TVFs). You can now add TVFs to your entity data model. A TVF is similar to a stored procedure, but the result of executing the TVF is composable, meaning you can use it as part of a LINQ query. For more information, see Walkthrough: Mapping an Entity to Table-valued Functions.
-
SQL generation improvements, especially around optimizing queries over models with table-per-type (TPT) inheritance.
-
LINQ queries are now automatically compiled and cached to improve query performance. In previous releases of the Entity Framework, you could use the CompiledQuery class to compile a LINQ query explicitly but starting with this release the compilation happens automatically for LINQ queries.
-
Support for multiple diagrams for a model. Each diagram can contain entities and relationships to make visualizing your model easier. You can switch between diagrams using the Model Browser and include related entities on each diagram as an optional command.
-
The StoreGeneratedPattern for key columns can now be set on an entity Properties window and this value will propagate from your entity model down to the store definition.
-
Ability to batch import your stored procedures as function imports when using the Entity Model Wizard. The result shape of each stored procedure will automatically become a new complex type in your entity model. This makes getting started with stored procedures very easy.
-
The Entity Designer surface now supports selection driven highlighting and entity shape coloring.
- EF 5.x DbContext Generator - generates object-layer code that supports Entity Framework 5.0.
-
The performance enhancements described in the following blog: Sneak Preview: Entity Framework 5.0 Performance Improvements.
-
The runtime support for mapping a stored procedure that returns multiple result sets to the types in your conceptual model. Note, that currently there is no Entity Designer support for this feature and you must manually modify the CSDL and MSL sections of the edmx file.
-
Starting with Entity Framework 5.0, the EntityFramework.dll does not contain definitions for data annotations. These definitions were moved to System.ComponentModel.DataAnnotations.dll and are defined in the System.ComponentModel.DataAnnotations.Schema namespace.
-
Visual Studio 11 Beta includes LocalDb database server rather than SQLEXPRESS. During installation, the EntityFramework NuGet package checks which database server is available. The NuGet package will then update the configuration file by setting the default database server that Code First uses when creating a connection by convention. If SQLEXPRESS is running, it will be used. If SQLEXPRESS is not available then LocalDb will be registered as the default instead. No changes are made to the configuration file if it already contains a setting for the default connection factory.
For more information, see What’s New in Entity Framework 5.0 RC.
What’s New in Entity Framework 4.3 and 4.3.1
The following features were added to the Entity Framework 4.3 and 4.3.1:
Code First Migrations
For more information, see Automatic Migrations Walkthrough and Code-Based Migrations Walkthrough.
Removal of EdmMetadata Table
If you use Code First to create a database by simply running your application (without using migrations), Visual Studio now creates the database by using an automatic migration. You can then enable migrations and continue evolving your database using migrations.
Configuration File Settings
For more information, see EF 4.3 Configuration File Settings.
Changes to GetDatabaseValues Method
In earlier releases the GetDabaseValues method would fail if your entity classes and context were in different namespaces. This issue is now fixed, and the classes don’t need to be in the same namespace to use GetDatabaseValues.
Unicode DbSet Names
In earlier releases you would get an exception when you ran a query against a DbSet object that contained Unicode characters. This issue is now fixed.
Data Annotations on Non-Public Properties
By default, building a database using Code First does not include private, protected, or internal properties. If you manually included these properties in your model, Code First would ignore any data annotations on those members. This is issue now fixed, and Code First processes the data annotations.
New Types
The types in the following namespace were added in Entity Framework 4.3.
System.Data.Entity.Migrations.Builders
System.Data.Entity.Migrations.Design
System.Data.Entity.Migrations.History
System.Data.Entity.Migrations.Infrastructure
System.Data.Entity.Migrations.Model
EF 4.3.1
For more information, see What’s New in EF4.3.1
What’s New in Entity Framework 4.2
The following features were added to the Entity Framework 4.2:
Versioning
Starting with version 4.2, Entity Framework is moving to sematic versioning. For more information about semantic versioning see the article Semantic Versioning.
New Types
Entity Framework 4.2 includes the following new types:
System.Data.Entity.Infrastructure.DbContextInfo
System.Data.Entity.Infrastructure.DbContextInfo
System.Data.Entity.Infrastructure.IDbContextFactory
What’s New in Entity Framework 4.1
The following features were added to the Entity Framework 4.1:
DbContext
The System.Data.Entity.DbContext is a simplified abstraction over ObjectContext and a number of other types that were included in previous releases of the ADO.NET Entity Framework. The DbContext API surface is optimized for common tasks and coding patterns. DbContext can be used with Database First, Model First, and Code First development.
System.Data.Entity.DbContext is the preferred method for interacting with a database unless you need features that are only present in ObjectContext.
Code First
Code First is a new development pattern for the ADO.NET Entity Framework and provides an alternative to the existing Database First and Model First patterns. Code First is focused around defining your model using C#/VB.NET classes, these classes can then be mapped to an existing database or be used to generate a database schema. Additional configuration can be supplied using Data Annotations or via a fluent API. For more information, see Code First Development.
DbContext Code Generation Template
The ADO.NET DbContext Generator template can be downloaded from the visual studio gallery. The template generates persistence-ignorant entity types, also known as "plain-old CLR objects” (POCO types), and a derived System.Data.Entity.DbContext type that contains System.Data.Entity.DbSet properties for each type in the model.
Validation
DbContext automatically validates entities before saving them to the database. Validation is performed based on model facets as well as on data annotations. Entities can also be validated on demand.
Build Date:
Tip: