GithubHelp home page GithubHelp logo

Writing values of 'NpgsqlTypes.NpgsqlRange`1[[System.TimeSpan, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]][]' is not supported for parameters having NpgsqlDbType '-2147483608'. about efcore.pg HOT 3 OPEN

NazarPolevyi avatar NazarPolevyi commented on June 19, 2024
Writing values of 'NpgsqlTypes.NpgsqlRange`1[[System.TimeSpan, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]][]' is not supported for parameters having NpgsqlDbType '-2147483608'.

from efcore.pg.

Comments (3)

NinoFloris avatar NinoFloris commented on June 19, 2024 1

@NazarPolevyi

I notice your entity has the following attribute

  [Column("allowed_time_ranges", TypeName = "timerange[]")]
    public NpgsqlRange<TimeSpan>? AllowedTimeRanges { get; set; }

Specifically timerange[] while the clr type is not an array/list. Can you remove [] and try again?

from efcore.pg.

NinoFloris avatar NinoFloris commented on June 19, 2024

@roji this might be related to https://github.com/npgsql/npgsql/pull/5123/files#r1325747341

If so setting the actual datatypename of the range on the param should solve it.

EDIT: traced the regstration to

var unquotedRangeStoreType = rangeDefinition.SchemaName is null
which suggests that's already happening. Not sure how we end up with a is not supported for parameters having NpgsqlDbType kind of error. That only happens if it was set somehow.

from efcore.pg.

NazarPolevyi avatar NazarPolevyi commented on June 19, 2024

@NinoFloris
Thanks for answer.
@roji What do you think?

I'm sorry. The issue is actually related to array of ranges NpgSqlRange<TimeSpan>[]. So the entity class should look like this.

public class RestrictionSettings
{
    [Column("id")]
    public Guid Id { get; set; }

    [Column("allowed_time_ranges", TypeName = "timerange[]")]
    public NpgsqlRange<TimeSpan>[]? AllowedTimeRanges { get; set; }
}

Usual NpgSqlRange<TimeSpan> works fine.


public class RestrictionSettings
{
    [Column("id")]
    public Guid Id { get; set; }

    [Column("allowed_time_ranges", TypeName = "timerange")]
    public NpgsqlRange<TimeSpan> AllowedTimeRanges { get; set; }
}

Is it possible to use array(NpgsqlRange[]) now in 8.02 version?
Btw, NpgsqlRange<DateTime>[] works well without specifying custom range type. But for the NpgsqlRange<TimeSpan>[] it's not

from efcore.pg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.