Today we’re making the final version of EF Core 2.2 available, alongside . This is the latest release of our open-source and cross-platform object-database mapping technology.
EF Core 2.2 RTM includes more than a hundred bug fixes and a few new features:
Spatial data support
Spatial data can be used to represent the physical location and shape of objects. Many databases can natively store, index, and query spatial data. Common scenarios include querying for objects within a given distance, and testing if a polygon contains a given location. EF Core 2.2 now supports working with spatial data from various databases using types from the , (from the without additional extensions.
Once the provider extension is installed, you can add properties of supported types to your entities. For example:
using NetTopologySuite.Geometries;
namespace MyApp
{
public class Friend
{
[Key]
public string Name { get; set; }
[Required]
public Point Location { get; set; }
}
}You can then persist entities with spatial data:
using (var context = new MyDbContext())
{
context.Add(
new Friend
{
Name = "Bill",
Location = new Point(-122.34877, 47.6233355) {SRID = 4326 }
});
context.SaveChanges();
}And you can execute database queries based on spatial data and operations:
var nearestFriends =
(from f in context.Friends
orderby f.Location.Distance(myLocation) descending
select f).Take(5).ToList();For more information on this feature, see the .
Query tags
This feature simplifies the correlation of LINQ queries in code with generated SQL queries captured in logs.
To take advantage of query tags, you annotate a LINQ query using the new TagWith() method. Using the spatial query from a previous example:
var nearestFriends =
(from f in context.Friends.TagWith(@"This is my spatial query!")
orderby f.Location.Distance(myLocation) descending
select f).Take(5).ToList();This LINQ query will produce the following SQL output:
-- This is my spatial query!
SELECT TOP(@__p_1) [f].[Name], [f].[Location]
FROM [Friends] AS [f]
ORDER BY [f].[Location].STDistance(@__myLocation_0) DESCFor more information, see the , and also as part of .
If you want to use EF Core in an application based on ASP.NET Core, we recommend that first you upgrade your application to .
Compatibility with EF Core 2.1
We spent much time and effort making sure that EF Core 2.2 is backwards compatible with existing EF Core 2.1 providers, and that updating an application to build on EF Core 2.2 won’t cause compatibility issues. We expect most upgrades to be smooth, however if you find any unexpected issues, please report them to our Type configured as both owned entity and regular entity requires a primary key to be defined after upgrading from 2.1 to 2.2
We intend to maintain . The new plan is to continue developing the provider alongside EF Core 3.0.
C# 8.0 support: We want our customers to take advantage some of the .
SOCIAL SHARE CARD GENERATOR