Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime 6.0.7

.NET 6.0 .NET Standard 2.0
There is a newer prerelease version of this package available.
See the version list below for details.
NuGet\Install-Package Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime -Version 6.0.7
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime --version 6.0.7
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime" Version="6.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime --version 6.0.7
#r "nuget: Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime, 6.0.7"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime as a Cake Addin
#addin nuget:?package=Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime&version=6.0.7

// Install Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime as a Cake Tool
#tool nuget:?package=Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime&version=6.0.7

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 use the NodaTime date/time library when interacting with PostgreSQL; this provides a better and safer API for dealing with date and time data.

To use the plugin, simply add UseNodaTime as below and use NodaTime types in your entity properties:

await using var ctx = new BlogContext();
await ctx.Database.EnsureDeletedAsync();
await ctx.Database.EnsureCreatedAsync();

// Insert a Blog
ctx.Blogs.Add(new()
{
    Name = "FooBlog",
    CreationTime = SystemClock.Instance.GetCurrentInstant()
});
await ctx.SaveChangesAsync();

// Query all blogs created in 2020 or after
var newBlogs = await ctx.Blogs.Where(b => b.CreationTime >= Instant.FromUtc(2020, 1, 1, 0, 0, 0)).ToListAsync();

public class BlogContext : DbContext
{
    public DbSet<Blog> Blogs { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        => optionsBuilder.UseNpgsql(
            @"Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase",
            o => o.UseNodaTime());
}

public class Blog
{
    public int Id { get; set; }
    public string Name { get; set; }
    public Instant CreationTime { get; set; }
}

The plugin also supports translating most NodaTime methods and properties into corresponding PostgreSQL date/time operations. For more information, see the NodaTime plugin documentation page.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime:

Package Downloads
devprime.stack.state

DevPrime State

SvrdSdk.AspNetCore

Package Description

LS.Helpers.Hosting

.NET Core helpers for ASP.NET hosting

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime:

Repository Stars
ErikEJ/EFCorePowerTools
Entity Framework Core Power Tools - reverse engineering, migrations and model visualization for EF Core
NosCoreIO/NosCore
NosCore is a Nostale emulator in c# (.Net 6) using DotNetty / Entity Framework / WebAPI / Autofac / Mapster / Serilog
Version Downloads Last updated
7.0.0-rc.1 277 9/16/2022
7.0.0-preview.7 623 8/9/2022
7.0.0-preview.6 413 7/13/2022
7.0.0-preview.5 192 6/19/2022
7.0.0-preview.4 311 5/11/2022
7.0.0-preview.3 256 4/19/2022
7.0.0-preview.2 107 3/16/2022
7.0.0-preview.1 379 2/17/2022
6.0.7 3,750 9/16/2022
6.0.6 53,372 8/4/2022
6.0.5 67,106 6/19/2022
6.0.4 138,175 4/19/2022
6.0.3 130,671 1/27/2022
6.0.2 114,228 12/22/2021
6.0.1 32,086 12/3/2021
6.0.0 30,732 11/9/2021
6.0.0-rc.2 1,011 10/14/2021
6.0.0-rc.1 1,065 9/24/2021
6.0.0-preview7 1,691 8/16/2021
6.0.0-preview6 225 7/31/2021
6.0.0-preview5 298 7/1/2021
6.0.0-preview4 304 5/27/2021
6.0.0-preview3 313 4/15/2021
6.0.0-preview2 257 3/11/2021
6.0.0-preview1 257 2/16/2021
5.0.10 306,074 9/15/2021
5.0.7 256,864 6/13/2021
5.0.6 70,192 5/11/2021
5.0.5.1 41,671 4/21/2021
5.0.5 7,832 4/16/2021
5.0.2 296,182 1/19/2021
5.0.1 57,889 12/12/2020
5.0.0 21,289 11/15/2020
5.0.0-rc2 4,122 10/15/2020
5.0.0-rc1 3,223 9/14/2020
5.0.0-preview8 378 8/27/2020
5.0.0-preview7 421 7/22/2020
5.0.0-preview6 960 6/26/2020
5.0.0-preview5 306 6/11/2020
5.0.0-preview4 376 5/19/2020
5.0.0-preview3 346 4/24/2020
5.0.0-preview2 430 4/2/2020
5.0.0-preview.2.20120.8 259 3/20/2020
3.1.18 15,070 8/27/2021
3.1.11 33,285 1/21/2021
3.1.4 312,448 5/29/2020
3.1.3 132,432 3/26/2020
3.1.2 17,152 2/20/2020
3.1.1 22,436 1/31/2020
3.1.0 24,780 12/4/2019
3.1.0-preview3 2,377 11/15/2019
3.1.0-preview2 327 11/6/2019
3.0.1 10,306 10/2/2019
3.0.0 6,596 9/26/2019
3.0.0-preview9 2,000 9/4/2019
3.0.0-preview8 454 8/15/2019
3.0.0-preview7 449 7/25/2019
3.0.0-preview5 517 5/6/2019
3.0.0-preview4 398 4/21/2019
3.0.0-preview3 439 3/12/2019
3.0.0-preview1 704 12/16/2018
2.2.4 61,813 5/21/2019
2.2.0 62,199 12/7/2018
2.1.1 206,595 7/1/2018
2.1.0 2,677 5/31/2018
2.1.0-rc1 748 5/8/2018