XO.EntityFrameworkCore.NpgsqlJsonSerializerOptions 1.1.21

There is a newer version of this package available.
See the version list below for details.
dotnet add package XO.EntityFrameworkCore.NpgsqlJsonSerializerOptions --version 1.1.21                
NuGet\Install-Package XO.EntityFrameworkCore.NpgsqlJsonSerializerOptions -Version 1.1.21                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XO.EntityFrameworkCore.NpgsqlJsonSerializerOptions" Version="1.1.21" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XO.EntityFrameworkCore.NpgsqlJsonSerializerOptions --version 1.1.21                
#r "nuget: XO.EntityFrameworkCore.NpgsqlJsonSerializerOptions, 1.1.21"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install XO.EntityFrameworkCore.NpgsqlJsonSerializerOptions as a Cake Addin
#addin nuget:?package=XO.EntityFrameworkCore.NpgsqlJsonSerializerOptions&version=1.1.21

// Install XO.EntityFrameworkCore.NpgsqlJsonSerializerOptions as a Cake Tool
#tool nuget:?package=XO.EntityFrameworkCore.NpgsqlJsonSerializerOptions&version=1.1.21                

An Entity Framework Core plugin that adds support for JsonSerializerOptions to the Npgsql provider. You could use it to influence the property naming policy, or to use JSON source generation. These features are planned for Entity Framework Core 8.0, but until then...

Usage

  1. Call the extension method to add the plugin to your DbContext. Optionally, configure default JsonSerializerOptions to activate the plugin for all json and jsonb columns.

     protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
     {
     	optionsBuilder
     		.UseNpgsql("Host=localhost")
     		.UseNpgsqlJsonSerializerOptions(defaultJsonSerializerOptions: null);
     }
    
  2. Call UseJsonSerializerOptions to configure JsonSerializerOptions for a specific property.

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<MyEntity>(entity =>
        {
            entity.Property(x => x.MyJsonProperty)
                .HasColumnType("jsonb")
                .UseJsonSerializerOptions(new JsonSerializerOptions
                {
                    DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
                	PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
                });
        });
    }
    
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.13 16,004 5/13/2024
2.0.4 59,749 8/17/2023
1.1.21 49,895 4/28/2023
1.0.6 494 4/27/2023