You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to config the parameter stored type is timestamp without timezone. However, runtime exception is thrown:
Unhandled exception. System.InvalidCastException: Cannot write DateTime with Kind=Unspecified to PostgreSQL type 'timestamp with time zone', only UTC is supported. Note that it's not possible to mix DateTimes with different Kinds in an array/range. See the Npgsql.EnableLegacyTimestampBehavior AppContext switch to enable legacy behavior.
var method = typeof(ApplicationDbContext).GetMethod(nameof(Demo),
new[]
{
typeof(DateTime),
typeof(DateTime),
}) ?? throw new InvalidOperationException();
modelBuilder.HasDbFunction(method, builder =>
{
builder.HasParameter("in_from_dt")
.HasStoreType("timestamp without time zone");
builder.HasParameter("in_to_dt")
.HasStoreType("timestamp without time zone");
});
I tried to config parameter store type, but is doesn't work.
Yeah, unfortunately this is a known bug in EF itself - there's nothing that can be done in the PG provider specifically. Make sure to upvote the above issue and follow it for updates.
I tried to config the parameter stored type is
timestamp without timezone
. However, runtime exception is thrown:Here is my repo to repro issue that I met. https://github.com/vancodocton/Npgsql.Labs
The text was updated successfully, but these errors were encountered: