Entity Framework Core 3.0 和 Entity Framework 6.3 发布

Core 3.0 EF  Preview 7 and  EF 6.3  Preview 7 has been released, according to the official Fang Bowen , here is the update:

EF Core 3.0 Preview 7 new features:

  • Query improvements: made great progress in terms of new LINQ to achieve complete. For example, GroupBy, has a types of queries are automatically included and labeled conversion now working. In addition, EF Core, the first set of support LINQ operators SQL translation, such as UNION, CONAT, Intersecect and EXT.
  • Other major new features: Preview 7 also includes a new API, database operations for the interception. This EF interception function in the presence of 6 very similar, it allows you to write simple logic, simply open the database connection, commit the transaction, or execute a query, EFCore will automatically call that logic. They typically allow the interceptor to intercept occurs before or after the operation. When intercepting them before they occur, it may be bypassed and execution results taken to provide backup logic.

For example, to operate the command text, create a IDbCommandInterceptor:

public class MyCommandInterceptor : DbCommandInterceptor
{
    public override InterceptionResult? ReaderExecuting(
        DbCommand command, 
        CommandEventData eventData, 
        InterceptionResult? result)
    {
        // Manipulate the command text, etc. here...
        command.CommandText = command.CommandText...
        return result;
    }
}

And registering DbContext in:

services.AddDbContext(b =>
    b.UseSqlServer(connectionString)
     .AddInterceptors(new MyCommandInterceptor()));

  • Gets Preview 7 runtime and tools: EF Core 3.0 is designed as NuGet package distribution. In the past, by NuGet user interface, Visual Studio in the Package Manager console or DotNet Add Package command to add or upgrade the runtime on Preview 7. In all cases, including allowing installation of a pre-release version of the option. In 3.0, DotNet ef CLI tool is no longer as part of .NET Core SDK release, so before performing a migration or Scanffold command, you must install it as a global tool or a local tool. Due to limitations DotNet CLI tool, the tool mounting preview preview version need to specify at least a portion of the mount command, for example, to install DotNet ef 3.0 global preview tool, by running:
$ dotnet tool install --global dotnet-ef --version 3.0.0-*

 EF 6.3 Preview 7 new features:

In this preview, complete EF 6.3 .NET Core package to work on most of the work required for the project, and the use of NuGet PackageReference in all types of projects.

In EF 6.3, there are three main issues:

  1. NuGet Package Manager Console migration command working on .NET Core Project: This work has now been completed, and can be used in the Nightly version, which will be part of the preview 8
  2. Updated Visual Studio EF6 design that can handle new projects and files for .NET Core Project: This work has not yet started, plans to update Visual Studio 2019. Meanwhile, the official suggested EDMX processing files with .NET Framework target of the project, and then copy the final version of the .NET Core EDMX project.
  3. Migration command cross-platform command-line experience, similar to dotnet ef, but applies to EF6: in this plan.

Guess you like

Origin www.oschina.net/news/108508/entity-framework-core-3-0-and-entity-framework-6-3-released