C
C#14mo ago
Kroks

❔ EFCore NPGSQL: Date exception

Unhandled exception. Npgsql.PostgresException (0x80004005): 42883: function date_part(unknown, bigint) does not exist When executing this piece of code:
var users = ctx.ScrapedUsers
.Where(user => user.Parents.Any(x => x.Id == target.Id) && user.StatusesCount > 0 && user.ScreenName != null
&& !ctx.Profiles
.Where(x => x.Id == Context.Profile.Id)
.Take(1)
.Any(x => x.ProcessedUsers.Any(x => x.Id == user.Id)) && user.LastProcessed.Year == 1970)
.OrderBy(user => user.LastProcessed)
.Take(processingCount - scrapedUsers.Count)
.ToList();
var users = ctx.ScrapedUsers
.Where(user => user.Parents.Any(x => x.Id == target.Id) && user.StatusesCount > 0 && user.ScreenName != null
&& !ctx.Profiles
.Where(x => x.Id == Context.Profile.Id)
.Take(1)
.Any(x => x.ProcessedUsers.Any(x => x.Id == user.Id)) && user.LastProcessed.Year == 1970)
.OrderBy(user => user.LastProcessed)
.Take(processingCount - scrapedUsers.Count)
.ToList();
in context I have thise
modelBuilder.Entity<ScrapedUser>()
.Property(su => su.LastProcessed)
.HasConversion<long>();
modelBuilder.Entity<ScrapedUser>()
.Property(su => su.LastProcessed)
.HasConversion<long>();
2 Replies
Kroks
KroksOP14mo ago
The property "LastProcessed" however is a datetime Im guessing it is trying to apply date functions on a integer (on db side its an integer as its stored as unix) how would I go about it
Accord
Accord14mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server