Skip to content

character(13) data type in PostgreSQL database scaffolded as char data type in .NET Core 2.0 #370

@LuisMezas

Description

@LuisMezas

I'm using Npgsql.EntityFrameworkCore.PostgreSQL version 2.0.1
I have the next issue. pgAdmin 4 generates SQL as following:

rfc character(13) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT pk_empresas PRIMARY KEY (rfc)

The entire database is scaffolded into my .NET Core 2.0 project using the next command in Package Manager Console, which is done correctly.

Scaffold-DbContext "Host=localhost;Database=database;Username=pgadmin;Password=xxxx" Npgsql.EntityFrameworkCore.PostgreSQL -force

Until here, everything is fine, but when I go the scaffolded class/model of the table where I have the SQL generated by pgAdmin 4 as commented before.

I have the property scaffolded as following:
public char Rfc { get; set; }
And I can't really work with this, as this only holds a single UTF-16 character 😭
I need to explicitly work with a set of characters with a length of 13.

Is there something I can do at the moment?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions