Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite 9.0.0-rc.2
Npgsql Entity Framework Core provider for PostgreSQL
Npgsql.EntityFrameworkCore.PostgreSQL is the open source EF Core provider for PostgreSQL. It allows you to interact with PostgreSQL via the most widely-used .NET O/RM from Microsoft, and use familiar LINQ syntax to express queries.
This package is a plugin which allows you to interact with spatial data provided by the PostgreSQL PostGIS extension; PostGIS is a mature, standard extension considered to provide top-of-the-line database spatial features. On the .NET side, the plugin adds support for the types from the NetTopologySuite library, allowing you to read and write them directly to PostgreSQL.
To use the plugin, simply add UseNetTopologySuite
as below and use NetTopologySuite types in your entity properties:
await using var ctx = new BlogContext();
await ctx.Database.EnsureDeletedAsync();
await ctx.Database.EnsureCreatedAsync();
// Insert a Blog
ctx.Cities.Add(new()
{
Name = "FooCity",
Center = new Point(10, 10)
});
await ctx.SaveChangesAsync();
// Query all cities with the given center point
var newBlogs = await ctx.Cities.Where(b => b.Center == new Point(10, 10)).ToListAsync();
public class BlogContext : DbContext
{
public DbSet<City> Cities { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder.UseNpgsql(
@"Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase",
o => o.UseNetTopologySuite());
}
public class City
{
public int Id { get; set; }
public string Name { get; set; }
public Point Center { get; set; }
}
The plugin also supports translating many NetTopologySuite methods and properties into corresponding PostGIS operations. For more information, see the NetTopologySuite plugin documentation page.
No packages depend on Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite.
.NET 8.0
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 9.0.0-rc.2)
- Npgsql.NetTopologySuite (>= 8.0.5)
Version | Downloads | Last updated |
---|---|---|
9.0.0-rc.2 | 5 | 10/16/2024 |
9.0.0-rc.1 | 6 | 09/18/2024 |
9.0.0-preview.7 | 7 | 09/02/2024 |
9.0.0-preview.3 | 11 | 04/16/2024 |
9.0.0-preview.2 | 10 | 03/29/2024 |
9.0.0-preview.1 | 10 | 02/16/2024 |
8.0.10 | 5 | 10/18/2024 |
8.0.8 | 5 | 09/28/2024 |
8.0.4 | 11 | 05/23/2024 |
8.0.2 | 9 | 02/20/2024 |
8.0.0 | 12 | 11/24/2023 |
8.0.0-rc.2 | 11 | 10/19/2023 |
8.0.0-rc.1 | 11 | 09/19/2023 |
8.0.0-preview.7 | 13 | 09/10/2023 |
8.0.0-preview.4 | 37 | 06/06/2023 |
8.0.0-preview.3 | 36 | 05/14/2023 |
8.0.0-preview.2 | 28 | 04/04/2023 |
8.0.0-preview.1 | 36 | 04/04/2023 |
7.0.18 | 12 | 05/23/2024 |
7.0.11 | 13 | 09/23/2023 |
7.0.4 | 30 | 06/06/2023 |
7.0.3 | 37 | 04/04/2023 |
7.0.1 | 22 | 01/15/2023 |
7.0.0 | 20 | 12/10/2022 |
7.0.0-rc.2 | 16 | 10/15/2022 |
7.0.0-rc.1 | 24 | 09/25/2022 |
7.0.0-preview.7 | 19 | 08/13/2022 |
7.0.0-preview.6 | 29 | 09/11/2022 |
7.0.0-preview.5 | 21 | 09/11/2022 |
7.0.0-preview.4 | 35 | 09/11/2022 |
7.0.0-preview.3 | 37 | 09/11/2022 |
7.0.0-preview.2 | 25 | 09/11/2022 |
7.0.0-preview.1 | 32 | 09/11/2022 |
6.0.29 | 9 | 05/23/2024 |
6.0.22 | 13 | 09/22/2023 |
6.0.8 | 49 | 01/15/2023 |
6.0.7 | 19 | 09/22/2022 |
6.0.6 | 44 | 09/11/2022 |
6.0.5 | 22 | 09/11/2022 |
6.0.4 | 25 | 09/11/2022 |
6.0.3 | 18 | 06/27/2022 |
6.0.2 | 26 | 09/11/2022 |
6.0.1 | 28 | 09/11/2022 |
6.0.0 | 30 | 09/11/2022 |
6.0.0-rc.2 | 21 | 09/11/2022 |
6.0.0-rc.1 | 14 | 09/11/2022 |
6.0.0-preview7 | 18 | 09/11/2022 |
6.0.0-preview6 | 18 | 09/11/2022 |
6.0.0-preview5 | 23 | 09/11/2022 |
6.0.0-preview4 | 18 | 09/11/2022 |
6.0.0-preview3 | 20 | 09/12/2022 |
6.0.0-preview2 | 24 | 09/11/2022 |
6.0.0-preview1 | 26 | 09/11/2022 |
5.0.10 | 28 | 09/11/2022 |
5.0.7 | 39 | 09/11/2022 |
5.0.6 | 30 | 09/11/2022 |
5.0.5.1 | 28 | 09/11/2022 |
5.0.5 | 23 | 09/11/2022 |
5.0.2 | 30 | 09/11/2022 |
5.0.1 | 16 | 09/11/2022 |
5.0.0 | 40 | 09/11/2022 |
5.0.0-rc2 | 21 | 09/11/2022 |
5.0.0-rc1 | 28 | 09/11/2022 |
5.0.0-preview8 | 18 | 09/11/2022 |
5.0.0-preview7 | 19 | 09/11/2022 |
5.0.0-preview6 | 19 | 09/12/2022 |
5.0.0-preview5 | 38 | 09/11/2022 |
5.0.0-preview4 | 15 | 09/11/2022 |
5.0.0-preview3 | 43 | 09/11/2022 |
5.0.0-preview2 | 20 | 09/11/2022 |
5.0.0-preview.2.20120.8 | 31 | 09/11/2022 |
3.1.18 | 29 | 09/11/2022 |
3.1.11 | 23 | 09/11/2022 |
3.1.4 | 48 | 09/11/2022 |
3.1.3 | 22 | 09/11/2022 |
3.1.2 | 14 | 09/11/2022 |
3.1.1 | 60 | 09/22/2022 |
3.1.0 | 15 | 09/11/2022 |
3.1.0-preview3 | 19 | 09/11/2022 |
3.1.0-preview2 | 59 | 09/11/2022 |
3.0.1 | 17 | 09/11/2022 |
3.0.0 | 35 | 09/11/2022 |
3.0.0-preview9 | 16 | 09/11/2022 |
3.0.0-preview5 | 23 | 09/11/2022 |
3.0.0-preview4 | 30 | 09/11/2022 |
3.0.0-preview3 | 18 | 09/11/2022 |
3.0.0-preview1 | 14 | 09/11/2022 |
2.2.4 | 24 | 09/11/2022 |
2.2.0 | 19 | 09/11/2022 |
2.1.1 | 22 | 09/11/2022 |
2.1.0 | 21 | 09/11/2022 |
2.1.0-rc1 | 18 | 09/11/2022 |