Skip to content

Json column type instead of jsonb with .ToJson() #3319

Closed as duplicate
Closed as duplicate

Description

@Mandrakia

I haven't found a place where we can specify the column type. If I write something like

  modelBuilder.Entity<ProspectAdFilter>(entity =>
  {
      entity.OwnsOne(a => a.Model, x =>
      {
          x.ToJson("ModelJson").HasColumnType("json");
      });
  }); 

It results in a an error as the property is mapped to a string in the model instead of an object.

Switching from json to jsonb is not really an option for us as it pushes the database from a measly 2Gb to a 65Gb one.

Activity

  1. roji commented on Oct 17, 2024

    @roji
    Member

    Duplicate of dotnet/efcore#28452

  2. roji commented on Oct 17, 2024

    @roji
    Member

    This should be available on 9.0 - give 9.0.0-rc.2 a try and let me know if you're hitting issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions