ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly 7.0.10

Prefix Reserved
dotnet add package ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly --version 7.0.10
                    
NuGet\Install-Package ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly -Version 7.0.10
                    
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.
<PackageReference Include="ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly" Version="7.0.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly" Version="7.0.10" />
                    
Directory.Packages.props
<PackageReference Include="ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly --version 7.0.10
                    
#r "nuget: ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly, 7.0.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly&version=7.0.10
                    
Install ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly as a Cake Addin
#tool nuget:?package=ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly&version=7.0.10
                    
Install ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly as a Cake Tool

ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly

build status latest version downloads license

Adds .NET 6 or later DateOnly and TimeOnly support to the SQL Server EF Core provider. These types map directly to the SQL Server date and time data types.

Installation

The latest version is available on NuGet.

dotnet add package ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly

Compatibility

The following table show which version of this library to use with which version of EF Core.

EF Core Version to use
6.0 6.0.x
7.0 7.0.x
8.0+ Built-in

Usage

Enable DateOnly and TimeOnly support by calling UseDateOnlyTimeOnly inside UseSqlServer. UseSqlServer is is typically called inside Startup.ConfigureServices or OnConfiguring of your DbContext type.

options.UseSqlServer(
    connectionString,
    x => x.UseDateOnlyTimeOnly());

Add DateOnly and TimeOnly properties to your entity types. Or reverse engineer a table with date and time columns.

class EventSchedule
{
    public int Id { get; set; }
    public DateOnly StartDate { get; set; }
    public TimeOnly TimeOfDay { get; set; }
}

Insert data.

dbContext.Add(new EventSchedule { StartDate = new DateOnly(2022, 12, 24), TimeOfDay = new TimeOnly(12, 00) });
dbContext.SaveChanges();

Query.

var eventsOfTheDay = from e in dbContext.EventSchedules
                     where e.StartDate == new DateOnly(2022, 10, 12)
                     select e;

See also

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly:

Package Downloads
LykkeBiz.Common.MsSql

Microsoft SQL server EF Core DBContext with Lykke specific

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
7.0.10 95,534 6/3/2024
7.0.9 29,693 5/8/2024
7.0.8 67,446 1/31/2024
7.0.7 8,490 1/11/2024
7.0.6 24,210 12/12/2023
7.0.5 192,573 6/9/2023
7.0.4 15,955 5/11/2023
7.0.4-preview1 177 5/9/2023
7.0.3 13,156 4/19/2023
7.0.2 16,692 4/4/2023
7.0.1 122,977 1/27/2023
7.0.0 2,870 1/20/2023
7.0.0-preview.3 3,124 12/14/2022
7.0.0-preview.2 132 12/9/2022
7.0.0-preview.1 455 12/6/2022
6.0.11 2,457 10/6/2024
6.0.10 14,253 6/3/2024
6.0.9 965 5/8/2024
6.0.8 13,913 1/31/2024
6.0.7 803 1/11/2024
6.0.6 7,542 12/12/2023
6.0.5 23,114 6/9/2023
6.0.4 2,619 5/11/2023
6.0.4-preview1 162 5/9/2023
6.0.3 7,841 4/19/2023
6.0.2 1,722 4/4/2023
6.0.1 166,553 1/27/2023
6.0.0 1,748 1/20/2023
6.0.0-preview.3 2,644 12/14/2022
6.0.0-preview.2 118 12/9/2022
6.0.0-preview.1 930 12/6/2022

Update to M.D.S. 5.2.1