mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-05-09 07:08:01 +08:00
fix #I975H7
This commit is contained in:
parent
65f1d3d761
commit
71b72ca06e
@ -7,6 +7,7 @@ using Infrastructure.Utilities;
|
|||||||
|
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
@ -84,6 +85,28 @@ namespace OpenAuth.Repository
|
|||||||
.HasKey(c => new { c.Id });
|
.HasKey(c => new { c.Id });
|
||||||
modelBuilder.Entity<SysTableColumn>().HasNoKey();
|
modelBuilder.Entity<SysTableColumn>().HasNoKey();
|
||||||
modelBuilder.Entity<QueryStringObj>().HasNoKey();
|
modelBuilder.Entity<QueryStringObj>().HasNoKey();
|
||||||
|
|
||||||
|
//converting between PostgreSQL smallint and .NET Boolean types
|
||||||
|
if (Database.ProviderName == "Npgsql.EntityFrameworkCore.PostgreSQL")
|
||||||
|
{
|
||||||
|
var boolToSmallIntConverter = new ValueConverter<bool, short>(
|
||||||
|
v => v ? (short)1 : (short)0,
|
||||||
|
v => v != 0);
|
||||||
|
foreach (var entityType in modelBuilder.Model.GetEntityTypes())
|
||||||
|
{
|
||||||
|
foreach (var property in entityType.GetProperties())
|
||||||
|
{
|
||||||
|
if (property.ClrType == typeof(bool))
|
||||||
|
{
|
||||||
|
property.SetValueConverter(boolToSmallIntConverter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual DbSet<Application> Applications { get; set; }
|
public virtual DbSet<Application> Applications { get; set; }
|
||||||
|
Loading…
Reference in New Issue
Block a user