Created
March 30, 2023 20:19
-
-
Save schmitch/6653bc7d74bdd970e922a9bdc755474d to your computer and use it in GitHub Desktop.
reproducer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ComponentModel.DataAnnotations; | |
using System.ComponentModel.DataAnnotations.Schema; | |
using Microsoft.EntityFrameworkCore; | |
using NodaTime; | |
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); | |
await using ApplicationDbContext db = new(); | |
await db.Database.EnsureDeletedAsync(); | |
await db.Database.EnsureCreatedAsync(); | |
var today = new LocalDate(2023, 3, 30); | |
await db.WorkflowListViewWithPrices.Where(d => d.WorkflowDateCreated.Date >= today).CountAsync(); | |
[Table("workflow_list_with_prices")] | |
public class WorkflowListElementWithPrice | |
{ | |
[Key] | |
[Column("workflow_id")] | |
public long WorkflowId { get; set; } | |
[Required] | |
[Column("workflow_date_created")] | |
public ZonedDateTime WorkflowDateCreated { get; set; } | |
} | |
public class ApplicationDbContext : DbContext | |
{ | |
public DbSet<WorkflowListElementWithPrice> WorkflowListViewWithPrices { get; set; } | |
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | |
=> optionsBuilder.UseNpgsql( | |
"Host=localhost;Username=postgres;Password=postgres;Database=temp;", | |
o => o.UseNodaTime()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment