EntityFramework 7 renamed to EntityFramework Core (pre-release status)

Source: Internet
Author: User
Tags net domain

Objective

Recently seldom to learn and explore new things, especially the EF field that has been more concerned about before, itself is not too lazy, but suffering from the environment compared to affect their own mood, so slow to write, but do not learn to feel in the spirit of the lack of something, but also have a friend said EF updated, I want to write another article, After the final struggle, it took a little time to continue to explore. This comparative theory is to share the recent EF progress, and there will be time to follow the EF team's movements on EF and give the corresponding examples.

EF Core 1.0.0

(1) EntityFramework is the data access technology recommended by Microsoft in. NET, while EntityFramework Core provides a similar developer experience to ef6.x, and it also supports LINQ, Poco, and code first It can also access relational and non-relational stored data, but EF core is lighter than previous versions of EF. At the same time, it was very good to be built at the very beginning, such as the use of devices such as Windows applications on ASP. Vnext, of course, in traditional. NET domain as well.

————————————————————————————————————————————————————————————————

(2) However, it is important to note that EF core is not fully bundled with ASP. NET core, and there are many features of EF core that are outside of the scope of ASP. It is part of the whole of ASP. So it is really important that you publish a stable EF core version as part of ASP. NET Core support.

————————————————————————————————————————————————————————————————

(3) Because EF core is a new codebase, the features implemented in the previous EF release are not necessarily implemented in EF core, so the EF team gives a list of the following to be implemented before the EF core release, as well as lists the features that the EF team believes are important and need to be implemented , however, it will not be enabled when the EF core is initially released. So this also means that the current version of EF 6.x in most applications is still the best choice until these features are implemented in the EF core code base.

Implemented (implemented)

The following features have been implemented and have been included before the official last official release. Note: "The features listed below may be present bugs may require EF team time to resolve and these APIs will still be subject to change before the first official release." 】

model (Modeling)

(1) Base model (Basic modeling): Based on POCO entities with Get/get attributes. Public properties are derived from the underlying class Couroux (string, int, and so on).

(2) Relationship (Relationship): An entity with navigation properties and foreign key attributes.

(3) Hide State properties (Shadow, properties): This property is only part of the model, that is, there are no properties corresponding to it in the CLR class.

(4) Uniqueness constraints and indexes (unique constraints an indexes): Whether the uniqueness constraint set on the target is a primary key relationship.

(5) Built-in conventions (built-in conventions): Constructs an initialization model of an entity class.

(6) Model validations: detects invalid patterns in the model and provides helpful error messages.

(7) The generation of key values: both in the background and in the database.

(8) Relationship (Relationnal): Allows an entity to be mapped to a column in a table.

Change Tracking (Tracking)

(1) snapshot change tracking (Snapshot tracking): Records the original value of an entity when interacting with the database.

(2) Access tracking status (Access tracked state): accesses the state of an entity through Dbcontext.entry and Dbcontext.changetracker.

(3) Additional detached entity diagram/(Attach detached entities/graphs): To save the new entity or modified entity, the entity is appended to the context through the Dbcontext.attachgraph APIs.

Save (SaveChanges)

(1) The Basic Save function (Basic save functionality): The changed entity is synchronized with the database.

(2) Optimistic concurrency (optimistic Concurrency): Prevents data from being overwritten by other users when data is fetched from the database.

(3) Asynchronous Save (Async SaveChanges): When SaveChanges is called, the database needs to do the appropriate action, freeing the current thread to handle the command issued by SaveChanges.

(4) Transaction (transactions): When SaveChanges is atomic it either commits all success or does not make any changes to the database data, There are related APIs for transactions to share transactions in the same context instance.

(5) Batch statement (batching statements): Provides better performance by batching multiple Insert/update/delete commands to a single round-trip to a database.

Queries (query)

(1) Supports Base LINQ (Basic LINQ Support): Provides LINQ processing of data from a database.

(2) Mixed client or server-side evaluation (Mixed client/server evaluation): Let the query contain logic that will not be evaluated in the database, while data returned from the database to memory must be evaluated.

(3) does not track (no Tracking): When the context does not need to monitor the change of the entity instance (that is, when we just read the data), this enables fast query.

(4) Starvation load (Eager loading): When querying the associated data, the associated data needs to be loaded by using the Include and Theninclude methods.

(5) Asynchronous query (async query): Frees the current thread to handle other requests when the database processes the query.

(6) Common BCL translation function (translation of common BCL functions): When using LINQ, launching these feature statements will be translated into a specific database query language.

(7) Raw SQL queries (Raw SQL query): Provides dbset.formsql to use raw SQL queries to get data. Of course, these queries can also be made up of LINQ.

Database schema Management (DB schema Management)

(1) Creation and deletion of database Creation/deletion APIs: The main purpose is to quickly create and delete databases without using data migration.

(2) Database error page: A middleware for ASP. NET 5, in order to provide assistance with database-related exceptions.

(3) About database migration (relational db migrations): Allows the database schema to change as the model changes.

databases provided (database providers)

(1) Entityframework.sqlserver: Connect to a database that is more than Microsoft SQL Server 2008.

(2) Entityframewrok.sqlite: Connect to a SQL Lite 3 database.

(3) Entityframework.inmemory: There is no connection to a real database which is mainly used for testing.

platform (plateforms)

(1) all. NET (full. NET): Includes consoles, WPF, WinForm, ASP. 4, and more.

(2) ASP. 5: Includes all. NET and. NET Core.

(3) All Windows platforms (UWP): Applications can use SQLite to access local data.

In progress (in Progress)

The following features are being implemented, may be valid in some scenarios, and may not be fully used yet there are some limitations.

Model (Modeling)

(1) Data annotaions: Add an attribute to an entity class or attribute to affect the entity.

(2) TPH inheritance mode (TPH inheritance pattern): Identifies the entity type on the inheritance and saves it to a single table through the distinguished field in the given record in the database.

Cross-domain Nature (cross-cutting quality)

(1) Document (documentation): Will develop the documentation for EF core "link:entityframework.docs"

(2) Smart hint document (IntelliSense documentation): Smart hints are available when using EF APIs in Visual Studio.

(3) Previous APIs (APIs review): Because of the previous EF APIs, a clean and consistent APIs will be given.

Performance (performance)

(1) Additional coverage (Additional converage): The test component may have additional coverage.

(2) Performance improvement (performance improvements): Performance bottlenecks are in progress.

Queries (query)

Navigation attribute translation (Navagation property translation): A field that allows direct point-out navigation properties through LINQ, such as (Products.where (p=>p.category.name== "Cnblogs")).

Reverse engineering (Reverse engineer)

Allows the EF model to be reversed from an existing relational database schema.

Platform (plateforms)

EF Core can now work on Apple and Linux, but is improving in a more stable direction.

EF Core 1.0.0 Calendar

The following has been implemented before 1.0.0 was released, but it has not yet been formally enabled.

(1) Allow (for example, the migration) tool to find the context type and instantiate it to create the model and identify the database connected to its connection.

(2) Better support for changes in deployment databases for general application deployment.

(3) provides cascading deletions that should be removed by the child when the father deletes it.

(4) Initializing version logging in ASP. NET 5 is relatively straightforward and provides more friendly logging for subsequent records of updates.

Non-implemented features (Backlog Features)

EF Core will be the EF version recommended by the EF team, but there is a premise that EF core is the best choice for many applications, especially in the case of the UWP platform where EF 6.x does not work, and of course, for a large number of applications, The lack of the following features also makes EF 6.x a good choice.

Queries (query)

(1) Display loading (Explicit loading).

(2) subquery (sub queries).

(3) Convert group by to SQL (group by translation SQL).

Log (Logging)

(1) Good log record.

(2) Structured logging.

Model (Modeling)

Complex/value type (complex/value type).

Updating models (update model)

Update the data model from the database.

Change Tracking (Tracking)

(1) Supplement the APIs that are missing in ef6.x (for example: Reload "Reload", Getmodifiedproperties "get modified Properties", etc.).

(2) The entry method for the relationship.

(3) The entry method for database values.

Specific relationship (relational specific)

(1) cud based on stored procedures.

(2) connection elasticity.

High-priority feature (features)

Although a manifest is already listed for the non-implemented features described above, for the vast majority of applications, because there are no such high-priority features, it is this that makes EF core a more applauded release.

Model (Modeling)

(1) Hide the State entity (Shadow, entities).

(2) Mapping to methods, possible attribute patterns, immutable objects, and so on.

(3) Visualization model (visualize models).

(4) Supports composable functions (composable functions support).

(5) Custom Convention (Conventions)

(6) Entity or table splitting (entity/table splitting).

(7) Simple type conversion (e.g. from String->xml).

(8) There are many-to-many relationships that do not add entities (Many:many relationships without join entity).

Change Tracking (Tracking)

Notification of change tracking (Notification tracking).

Delete and change (CRUD)

(1) Basic data Storage (Seed).

(2) Lazy loading (lazy loading) "Based on feedback".

(3) Simple ETag type and starter card support (easy Etag-style concurrency token supports).

(4) Hunger Loading improvement (Eager loading) "such as: aggregation, filtering, derived classes, etc.".

(5) Simple interception mechanism for querying and updating (easy interception mechanisms for query and updates).

Provided by (Providers)

(1) ATS.

(2) Redis.

(3) Other non-relational databases.

Migration (migrations)

A non-DNX project based on a common language schema.

Specify provider (Provider specific)

Specifies the provider through the configuration file.

Conclusion

EF Core formerly known as EntityFramework 7, as for the name of the main two points, one for better cross-platform, and the second is to improve the performance of EF. This gives developers a better use of experience and allows for more. NET developers to use EF Core, as mentioned above, EF core will be lighter and more focused on its performance bottlenecks, perhaps a little less on EF performance.

EntityFramework 7 renamed to EntityFramework Core (pre-release status)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.