Home > Software engineering >  Equivalent datatype in entityframework core for postgressql's jsonb
Equivalent datatype in entityframework core for postgressql's jsonb

Time:12-15

I am using EntityFrameworkCore and PostgresSql in my application. Further I am using code first approach to generate the db tables. Now there is a column for which I want datatype as jsonb in postgres but I do not see such datatype in EntityFrameworkCore. In C# I tried with adding an attribute as [Column(TypeName="jsonb")] but still datatpe in postgres is text and I am able to insert non-jsonb data in my column using insert script which I don't want. So just want to check is there a way to fix this?

enter image description here

enter image description here

CodePudding user response:

Instead of a string, try using the JsonDocument type.

  • Related