ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly
7.0.8
Prefix Reserved
See the version list below for details.
dotnet add package ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly --version 7.0.8
NuGet\Install-Package ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly -Version 7.0.8
<PackageReference Include="ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly" Version="7.0.8" />
paket add ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly --version 7.0.8
#r "nuget: ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly, 7.0.8"
// Install ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly as a Cake Addin #addin nuget:?package=ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly&version=7.0.8 // Install ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly as a Cake Tool #tool nuget:?package=ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly&version=7.0.8
ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly
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 | Versions 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. |
-
net6.0
- Microsoft.Data.SqlClient (>= 5.1.5)
- Microsoft.EntityFrameworkCore.SqlServer (>= 7.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly:
Package | Downloads |
---|---|
ImmediaC.SimpleCms
ASP.NET Core based CMS |
|
LykkeBiz.Common.MsSql
Microsoft SQL server EF Core DBContext with Lykke specific |
|
MaldivasModel
Modelo de datos de Maldivas |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly:
Repository | Stars |
---|---|
ErikEJ/EFCorePowerTools
Entity Framework Core Power Tools - reverse engineering, migrations and model visualization in Visual Studio & CLI
|
Version | Downloads | Last updated |
---|---|---|
7.0.10 | 41,800 | 6/3/2024 |
7.0.9 | 20,047 | 5/8/2024 |
7.0.8 | 62,492 | 1/31/2024 |
7.0.7 | 8,079 | 1/11/2024 |
7.0.6 | 20,160 | 12/12/2023 |
7.0.5 | 186,540 | 6/9/2023 |
7.0.4 | 15,902 | 5/11/2023 |
7.0.4-preview1 | 163 | 5/9/2023 |
7.0.3 | 12,700 | 4/19/2023 |
7.0.2 | 16,447 | 4/4/2023 |
7.0.1 | 99,163 | 1/27/2023 |
7.0.0 | 2,704 | 1/20/2023 |
7.0.0-preview.3 | 3,076 | 12/14/2022 |
7.0.0-preview.2 | 116 | 12/9/2022 |
7.0.0-preview.1 | 439 | 12/6/2022 |
6.0.11 | 692 | 10/6/2024 |
6.0.10 | 9,370 | 6/3/2024 |
6.0.9 | 900 | 5/8/2024 |
6.0.8 | 6,875 | 1/31/2024 |
6.0.7 | 782 | 1/11/2024 |
6.0.6 | 6,880 | 12/12/2023 |
6.0.5 | 19,549 | 6/9/2023 |
6.0.4 | 2,457 | 5/11/2023 |
6.0.4-preview1 | 151 | 5/9/2023 |
6.0.3 | 7,054 | 4/19/2023 |
6.0.2 | 1,703 | 4/4/2023 |
6.0.1 | 152,573 | 1/27/2023 |
6.0.0 | 1,699 | 1/20/2023 |
6.0.0-preview.3 | 2,628 | 12/14/2022 |
6.0.0-preview.2 | 101 | 12/9/2022 |
6.0.0-preview.1 | 903 | 12/6/2022 |
Update M.D.S.