未验证 提交 4a3c035f 编写于 作者: S Shay Rojansky 提交者: GitHub

Bump dependencies (#1955)

EFCore -> 6.0.0-rc.1.21413.1 (5d9ae8d41d949562ee76a757b82d1ac2661aa26a)
MicrosoftExtensions -> 6.0.0-rc.1.21406.5
上级 af1ef248
<Project>
<PropertyGroup>
<EFCoreVersion>6.0.0-rc.1.21406.1</EFCoreVersion>
<MicrosoftExtensionsVersion>6.0.0-rc.1.21401.3</MicrosoftExtensionsVersion>
<EFCoreVersion>6.0.0-rc.1.21413.1</EFCoreVersion>
<MicrosoftExtensionsVersion>6.0.0-rc.1.21406.5</MicrosoftExtensionsVersion>
<NpgsqlVersion>6.0.0-preview7</NpgsqlVersion>
</PropertyGroup>
......
......@@ -231,162 +231,8 @@ Licensed under the Apache License, Version 2.0. See License.txt in the project r
<s:Boolean x:Key="/Default/UserDictionary/Words/=fixup/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=attacher/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Uniquify/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unlogged/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Xunit/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<!-- From here it's EFCore.PG stuff -->
<s:Boolean x:Key="/Default/UserDictionary/Words/=accessorholder/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=adbin/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=adnum/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=adrelid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=amname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=angeles/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=annotatable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=asserter/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=atthasdef/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=attidentity/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=attisdropped/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=attname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=attnotnull/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=attnum/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=attrdef/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=attrelid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=atttypid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=atttypmod/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=basetyp/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=basetypname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bigserial/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=blogs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bpchar/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=btrim/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bytea/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=cidr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=citext/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=cmax/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=cmin/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=confdeltype/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=confkey/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=confrelid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=conindid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=conkey/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=conname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=conrelid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=contype/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ctid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=databinding/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=datatype/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=daterange/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=datetimeoffset/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=datname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=deptype/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=downcasts/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=elemtyp/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=elemtypname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=endian/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=enumlabel/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=enumsortorder/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=enumtypid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=evaluatable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=exprs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=FFFFF/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=FFFFFF/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=floatrange/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=frncls/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=frnns/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Funcletization/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=hacky/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=hostmask/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=hstore/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=idxcls/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ilike/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=indclass/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=indexprs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=indexrelid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=indisprimary/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=indisunique/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=indkey/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=indnatts/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=indnkeyatts/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=indpred/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=indrelid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=inet/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=isempty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=lpad/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=lseg/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ltrim/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=macaddr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=maltesers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=masklen/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=migrator/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=mins/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=nano/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ndims/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=nextval/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=noda/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=northwind/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=npgsql/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=nspname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=numrange/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=nupkg/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=objid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=objoid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=objsubid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=opcdefault/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=opclass/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=opcname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ossp/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ownerns/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=pgcrypto/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=plpgsql/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Poco/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=postgis/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=postgre/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=postgresql/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=procid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=prodpic/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=proname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=qsre/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=refobjid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=refobjsubid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=regclass/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=regconfig/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=regtype/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=relam/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=relkind/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=relname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=relnamespace/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=resultsets/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=rpad/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=scaffolded/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=seqcls/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=seqns/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=setval/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=setweight/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=smallserial/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=strpos/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Subpath/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=subqueries/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=subquery/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=subscripted/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=tableoid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=tblcls/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=timestamptz/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=timetz/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=trunc/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=tsquery/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=tsrange/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=tstzrange/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=tsvector/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=typbasetype/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=typelem/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=typname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=typnamespace/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=typreceive/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=typtype/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=typtypmod/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=unlogged/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=unpooled/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=uuuu/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=varbit/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xmax/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xmin/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xunit/@EntryIndexedValue">True</s:Boolean>
\ No newline at end of file
......@@ -2,6 +2,6 @@
"sdk": {
"version": "6.0.100-preview.7.21379.14",
"rollForward": "latestMajor",
"allowPrerelease": "false"
"allowPrerelease": "true"
}
}
using System;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Scaffolding;
using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure;
namespace Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite.Scaffolding.Internal
{
public class NpgsqlNetTopologySuiteCodeGeneratorPlugin : ProviderCodeGeneratorPlugin
{
private static readonly MethodInfo _useNetTopologySuiteMethodInfo
= typeof(NpgsqlNetTopologySuiteDbContextOptionsBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlNetTopologySuiteDbContextOptionsBuilderExtensions.UseNetTopologySuite),
typeof(NpgsqlDbContextOptionsBuilder));
public override MethodCallCodeFragment GenerateProviderOptions()
=> new(nameof(NpgsqlNetTopologySuiteDbContextOptionsBuilderExtensions.UseNetTopologySuite));
=> new(_useNetTopologySuiteMethodInfo);
}
}
using System;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Scaffolding;
using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure;
namespace Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime.Scaffolding.Internal
{
public class NpgsqlNodaTimeCodeGeneratorPlugin : ProviderCodeGeneratorPlugin
{
private static readonly MethodInfo _useNodaTimeMethodInfo
= typeof(NpgsqlNodaTimeDbContextOptionsBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlNodaTimeDbContextOptionsBuilderExtensions.UseNodaTime),
typeof(NpgsqlDbContextOptionsBuilder));
public override MethodCallCodeFragment GenerateProviderOptions()
=> new(nameof(NpgsqlNodaTimeDbContextOptionsBuilderExtensions.UseNodaTime));
=> new(_useNodaTimeMethodInfo);
}
}
......@@ -2,10 +2,12 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Utilities;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata.Internal;
......@@ -14,6 +16,92 @@ namespace Npgsql.EntityFrameworkCore.PostgreSQL.Design.Internal
{
public class NpgsqlAnnotationCodeGenerator : AnnotationCodeGenerator
{
#region MethodInfos
private static readonly MethodInfo _modelHasPostgresExtensionMethodInfo1
= typeof(NpgsqlModelBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlModelBuilderExtensions.HasPostgresExtension), typeof(ModelBuilder), typeof(string));
private static readonly MethodInfo _modelHasPostgresExtensionMethodInfo2
= typeof(NpgsqlModelBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlModelBuilderExtensions.HasPostgresExtension), typeof(ModelBuilder), typeof(string), typeof(string),
typeof(string));
private static readonly MethodInfo _modelHasPostgresEnumMethodInfo
= typeof(NpgsqlModelBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlModelBuilderExtensions.HasPostgresEnum), typeof(ModelBuilder), typeof(string), typeof(string[]));
private static readonly MethodInfo _modelHasPostgresRangeMethodInfo
= typeof(NpgsqlModelBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlModelBuilderExtensions.HasPostgresRange), typeof(ModelBuilder), typeof(string), typeof(string));
private static readonly MethodInfo _modelUseSerialColumnsMethodInfo
= typeof(NpgsqlModelBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlModelBuilderExtensions.UseSerialColumns), typeof(ModelBuilder));
private static readonly MethodInfo _modelUseIdentityAlwaysColumnsMethodInfo
= typeof(NpgsqlModelBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlModelBuilderExtensions.UseIdentityAlwaysColumns), typeof(ModelBuilder));
private static readonly MethodInfo _modelUseIdentityByDefaultColumnsMethodInfo
= typeof(NpgsqlModelBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns), typeof(ModelBuilder));
private static readonly MethodInfo _modelUseHiLoMethodInfo
= typeof(NpgsqlModelBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlModelBuilderExtensions.UseHiLo), typeof(ModelBuilder), typeof(string), typeof(string));
private static readonly MethodInfo _modelHasAnnotationMethodInfo
= typeof(ModelBuilder).GetRequiredRuntimeMethod(
nameof(ModelBuilder.HasAnnotation), typeof(string), typeof(object));
private static readonly MethodInfo _entityTypeIsUnloggedMethodInfo
= typeof(NpgsqlEntityTypeBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlEntityTypeBuilderExtensions.IsUnlogged), typeof(EntityTypeBuilder), typeof(bool));
private static readonly MethodInfo _propertyUseSerialColumnMethodInfo
= typeof(NpgsqlPropertyBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlPropertyBuilderExtensions.UseSerialColumn), typeof(PropertyBuilder));
private static readonly MethodInfo _propertyUseIdentityAlwaysColumnMethodInfo
= typeof(NpgsqlPropertyBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn), typeof(PropertyBuilder));
private static readonly MethodInfo _propertyUseIdentityByDefaultColumnMethodInfo
= typeof(NpgsqlPropertyBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn), typeof(PropertyBuilder));
private static readonly MethodInfo _propertyHasIdentityOptionsMethodInfo
= typeof(NpgsqlPropertyBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlPropertyBuilderExtensions.HasIdentityOptions), typeof(PropertyBuilder), typeof(long?), typeof(long?),
typeof(long?), typeof(long?), typeof(bool?), typeof(long?));
private static readonly MethodInfo _indexUseCollationMethodInfo
= typeof(NpgsqlIndexBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlIndexBuilderExtensions.UseCollation), typeof(IndexBuilder), typeof(string[]));
private static readonly MethodInfo _indexHasMethodMethodInfo
= typeof(NpgsqlIndexBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlIndexBuilderExtensions.HasMethod), typeof(IndexBuilder), typeof(string));
private static readonly MethodInfo _indexHasOperatorsMethodInfo
= typeof(NpgsqlIndexBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlIndexBuilderExtensions.HasOperators), typeof(IndexBuilder), typeof(string[]));
private static readonly MethodInfo _indexHasSortOrderMethodInfo
= typeof(NpgsqlIndexBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlIndexBuilderExtensions.HasSortOrder), typeof(IndexBuilder), typeof(SortOrder[]));
private static readonly MethodInfo _indexHasNullSortOrderMethodInfo
= typeof(NpgsqlIndexBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlIndexBuilderExtensions.HasNullSortOrder), typeof(IndexBuilder), typeof(NullSortOrder[]));
private static readonly MethodInfo _indexIncludePropertiesMethodInfo
= typeof(NpgsqlIndexBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlIndexBuilderExtensions.IncludeProperties), typeof(IndexBuilder), typeof(string[]));
#endregion MethodInfos
public NpgsqlAnnotationCodeGenerator(AnnotationCodeGeneratorDependencies dependencies)
: base(dependencies) {}
......@@ -85,11 +173,9 @@ protected override bool IsHandledByConvention(IProperty property, IAnnotation an
{
var extension = new PostgresExtension(model, annotation.Name);
return extension.Schema == "public" || extension.Schema is null
? new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresExtension),
extension.Name)
: new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresExtension),
extension.Schema, extension.Name);
return extension.Schema is "public" or null
? new MethodCallCodeFragment(_modelHasPostgresExtensionMethodInfo1, extension.Name)
: new MethodCallCodeFragment(_modelHasPostgresExtensionMethodInfo2, extension.Schema, extension.Name);
}
if (annotation.Name.StartsWith(NpgsqlAnnotationNames.EnumPrefix, StringComparison.Ordinal))
......@@ -97,10 +183,8 @@ protected override bool IsHandledByConvention(IProperty property, IAnnotation an
var enumTypeDef = new PostgresEnum(model, annotation.Name);
return enumTypeDef.Schema == "public"
? new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresEnum),
enumTypeDef.Name, enumTypeDef.Labels)
: new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresEnum),
enumTypeDef.Schema, enumTypeDef.Name, enumTypeDef.Labels);
? new MethodCallCodeFragment(_modelHasPostgresEnumMethodInfo, enumTypeDef.Name, enumTypeDef.Labels)
: new MethodCallCodeFragment(_modelHasPostgresEnumMethodInfo, enumTypeDef.Schema, enumTypeDef.Name, enumTypeDef.Labels);
}
if (annotation.Name.StartsWith(NpgsqlAnnotationNames.RangePrefix, StringComparison.Ordinal))
......@@ -112,13 +196,13 @@ protected override bool IsHandledByConvention(IProperty property, IAnnotation an
rangeTypeDef.Collation == null &&
rangeTypeDef.SubtypeDiff == null)
{
return new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresRange),
return new MethodCallCodeFragment(_modelHasPostgresRangeMethodInfo,
rangeTypeDef.Schema == "public" ? null : rangeTypeDef.Schema,
rangeTypeDef.Name,
rangeTypeDef.Subtype);
}
return new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresRange),
return new MethodCallCodeFragment(_modelHasPostgresRangeMethodInfo,
rangeTypeDef.Schema == "public" ? null : rangeTypeDef.Schema,
rangeTypeDef.Name,
rangeTypeDef.Subtype,
......@@ -137,7 +221,9 @@ protected override bool IsHandledByConvention(IProperty property, IAnnotation an
Check.NotNull(annotation, nameof(annotation));
if (annotation.Name == NpgsqlAnnotationNames.UnloggedTable)
return new MethodCallCodeFragment(nameof(NpgsqlEntityTypeBuilderExtensions.IsUnlogged), annotation.Value);
{
return new MethodCallCodeFragment(_entityTypeIsUnloggedMethodInfo, annotation.Value);
}
return null;
}
......@@ -165,25 +251,19 @@ protected override bool IsHandledByConvention(IProperty property, IAnnotation an
case NpgsqlValueGenerationStrategy.SerialColumn:
return new List<MethodCallCodeFragment>
{
new(onModel
? nameof(NpgsqlModelBuilderExtensions.UseSerialColumns)
: nameof(NpgsqlPropertyBuilderExtensions.UseSerialColumn))
new(onModel ? _modelUseSerialColumnsMethodInfo : _propertyUseSerialColumnMethodInfo)
};
case NpgsqlValueGenerationStrategy.IdentityAlwaysColumn:
return new List<MethodCallCodeFragment>
{
new(onModel
? nameof(NpgsqlModelBuilderExtensions.UseIdentityAlwaysColumns)
: nameof(NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn))
new(onModel ? _modelUseIdentityAlwaysColumnsMethodInfo : _propertyUseIdentityAlwaysColumnMethodInfo)
};
case NpgsqlValueGenerationStrategy.IdentityByDefaultColumn:
return new List<MethodCallCodeFragment>
{
new(onModel
? nameof(NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns)
: nameof(NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn))
new(onModel ? _modelUseIdentityByDefaultColumnsMethodInfo : _propertyUseIdentityByDefaultColumnMethodInfo)
};
case NpgsqlValueGenerationStrategy.SequenceHiLo:
......@@ -192,7 +272,7 @@ protected override bool IsHandledByConvention(IProperty property, IAnnotation an
return new List<MethodCallCodeFragment>
{
new(
nameof(NpgsqlModelBuilderExtensions.UseHiLo),
_modelUseHiLoMethodInfo,
(name, schema) switch
{
(null, null) => Array.Empty<object>(),
......@@ -204,10 +284,7 @@ protected override bool IsHandledByConvention(IProperty property, IAnnotation an
case NpgsqlValueGenerationStrategy.None:
return new List<MethodCallCodeFragment>
{
new(
nameof(ModelBuilder.HasAnnotation),
NpgsqlAnnotationNames.ValueGenerationStrategy,
NpgsqlValueGenerationStrategy.None)
new(_modelHasAnnotationMethodInfo, NpgsqlAnnotationNames.ValueGenerationStrategy, NpgsqlValueGenerationStrategy.None)
};
default:
......@@ -232,7 +309,7 @@ private IReadOnlyList<MethodCallCodeFragment> GenerateIdentityOptions(IDictionar
return new List<MethodCallCodeFragment>
{
new(
nameof(NpgsqlPropertyBuilderExtensions.HasIdentityOptions),
_propertyHasIdentityOptionsMethodInfo,
identityOptions.StartValue,
identityOptions.IncrementBy == 1 ? null : (long?) identityOptions.IncrementBy,
identityOptions.MinValue,
......@@ -246,18 +323,18 @@ private IReadOnlyList<MethodCallCodeFragment> GenerateIdentityOptions(IDictionar
=> annotation.Name switch
{
RelationalAnnotationNames.Collation
=> new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.UseCollation), annotation.Value),
=> new MethodCallCodeFragment(_indexUseCollationMethodInfo, annotation.Value),
NpgsqlAnnotationNames.IndexMethod
=> new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasMethod), annotation.Value),
=> new MethodCallCodeFragment(_indexHasMethodMethodInfo, annotation.Value),
NpgsqlAnnotationNames.IndexOperators
=> new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasOperators), annotation.Value),
=> new MethodCallCodeFragment(_indexHasOperatorsMethodInfo, annotation.Value),
NpgsqlAnnotationNames.IndexSortOrder
=> new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasSortOrder), annotation.Value),
=> new MethodCallCodeFragment(_indexHasSortOrderMethodInfo, annotation.Value),
NpgsqlAnnotationNames.IndexNullSortOrder
=> new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasNullSortOrder), annotation.Value),
=> new MethodCallCodeFragment(_indexHasNullSortOrderMethodInfo, annotation.Value),
NpgsqlAnnotationNames.IndexInclude
=> new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.IncludeProperties), annotation.Value),
=> new MethodCallCodeFragment(_indexIncludePropertiesMethodInfo, annotation.Value),
_ => null
};
......
......@@ -28,10 +28,7 @@ public static class NpgsqlModelBuilderExtensions
/// <param name="name">The name of the sequence.</param>
/// <param name="schema">The schema of the sequence.</param>
/// <returns>The same builder instance so that multiple calls can be chained.</returns>
public static ModelBuilder UseHiLo(
this ModelBuilder modelBuilder,
string? name = null,
string? schema = null)
public static ModelBuilder UseHiLo(this ModelBuilder modelBuilder, string? name = null, string? schema = null)
{
Check.NotNull(modelBuilder, nameof(modelBuilder));
Check.NullButNotEmpty(name, nameof(name));
......@@ -145,8 +142,7 @@ public static class NpgsqlModelBuilderExtensions
/// </summary>
/// <param name="modelBuilder">The model builder.</param>
/// <returns>The same builder instance so that multiple calls can be chained.</returns>
public static ModelBuilder UseIdentityAlwaysColumns(
this ModelBuilder modelBuilder)
public static ModelBuilder UseIdentityAlwaysColumns(this ModelBuilder modelBuilder)
{
Check.NotNull(modelBuilder, nameof(modelBuilder));
......@@ -172,8 +168,7 @@ public static class NpgsqlModelBuilderExtensions
/// </summary>
/// <param name="modelBuilder">The model builder.</param>
/// <returns>The same builder instance so that multiple calls can be chained.</returns>
public static ModelBuilder UseIdentityByDefaultColumns(
this ModelBuilder modelBuilder)
public static ModelBuilder UseIdentityByDefaultColumns(this ModelBuilder modelBuilder)
{
Check.NotNull(modelBuilder, nameof(modelBuilder));
......@@ -199,8 +194,7 @@ public static class NpgsqlModelBuilderExtensions
/// </summary>
/// <param name="modelBuilder">The model builder.</param>
/// <returns>The same builder instance so that multiple calls can be chained.</returns>
public static ModelBuilder UseIdentityColumns(
this ModelBuilder modelBuilder)
public static ModelBuilder UseIdentityColumns(this ModelBuilder modelBuilder)
=> modelBuilder.UseIdentityByDefaultColumns();
/// <summary>
......
using Microsoft.EntityFrameworkCore;
using System;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Scaffolding;
using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure;
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Scaffolding.Internal
{
......@@ -9,6 +12,13 @@ namespace Npgsql.EntityFrameworkCore.PostgreSQL.Scaffolding.Internal
/// </summary>
public class NpgsqlCodeGenerator : ProviderCodeGenerator
{
private static readonly MethodInfo _useNpgsqlMethodInfo
= typeof(NpgsqlDbContextOptionsBuilderExtensions).GetRequiredRuntimeMethod(
nameof(NpgsqlDbContextOptionsBuilderExtensions.UseNpgsql),
typeof(DbContextOptionsBuilder),
typeof(string),
typeof(Action<NpgsqlDbContextOptionsBuilder>));
/// <summary>
/// Constructs an instance of the <see cref="NpgsqlCodeGenerator"/> class.
/// </summary>
......@@ -20,7 +30,7 @@ public NpgsqlCodeGenerator(ProviderCodeGeneratorDependencies dependencies)
string connectionString,
MethodCallCodeFragment? providerOptions)
=> new(
nameof(NpgsqlDbContextOptionsBuilderExtensions.UseNpgsql),
_useNpgsqlMethodInfo,
providerOptions == null
? new object[] { connectionString }
: new object[] { connectionString, new NestedClosureCodeFragment("x", providerOptions) });
......
......@@ -162,70 +162,28 @@ public static MethodInfo GetRequiredMethod(this Type type, string name, params T
}
public static PropertyInfo GetRequiredProperty(this Type type, string name)
{
var property = type.GetTypeInfo().GetProperty(name);
if (property == null)
{
throw new InvalidOperationException();
}
return property;
}
=> type.GetTypeInfo().GetProperty(name)
?? throw new InvalidOperationException($"Could not find property '{name}' on type '{type}'");
public static FieldInfo GetRequiredDeclaredField(this Type type, string name)
{
var field = type.GetTypeInfo().GetDeclaredField(name);
if (field == null)
{
throw new InvalidOperationException();
}
return field;
}
=> type.GetTypeInfo().GetDeclaredField(name)
?? throw new InvalidOperationException($"Could not find field '{name}' on type '{type}'");
public static MethodInfo GetRequiredDeclaredMethod(this Type type, string name)
{
var method = type.GetTypeInfo().GetDeclaredMethod(name);
if (method == null)
{
throw new InvalidOperationException();
}
return method;
}
=> type.GetTypeInfo().GetDeclaredMethod(name)
?? throw new InvalidOperationException($"Could not find method '{name}' on type '{type}'");
public static PropertyInfo GetRequiredDeclaredProperty(this Type type, string name)
{
var property = type.GetTypeInfo().GetDeclaredProperty(name);
if (property == null)
{
throw new InvalidOperationException();
}
return property;
}
=> type.GetTypeInfo().GetDeclaredProperty(name)
?? throw new InvalidOperationException($"Could not find property '{name}' on type '{type}'");
public static MethodInfo GetRequiredRuntimeMethod(this Type type, string name, params Type[] parameters)
{
var method = type.GetTypeInfo().GetRuntimeMethod(name, parameters);
if (method == null)
{
throw new InvalidOperationException();
}
return method;
}
=> type.GetTypeInfo().GetRuntimeMethod(name, parameters)
?? throw new InvalidOperationException($"Could not find method '{name}' on type '{type}'");
public static PropertyInfo GetRequiredRuntimeProperty(this Type type, string name)
{
var property = type.GetTypeInfo().GetRuntimeProperty(name);
if (property == null)
{
throw new InvalidOperationException();
}
return property;
}
=> type.GetTypeInfo().GetRuntimeProperty(name)
?? throw new InvalidOperationException($"Could not find property '{name}' on type '{type}'");
public static bool IsInstantiable(this Type type)
=> !type.IsAbstract
......
......@@ -58,7 +58,7 @@ public override async Task Create_table_all_settings()
CONSTRAINT ""PK_People"" PRIMARY KEY (""CustomId""),
CONSTRAINT ""AK_People_SSN"" UNIQUE (""SSN""),
CONSTRAINT ""CK_People_EmployerId"" CHECK (""EmployerId"" > 0),
CONSTRAINT ""FK_People_Employers_EmployerId"" FOREIGN KEY (""EmployerId"") REFERENCES ""Employers"" (""Id"") ON DELETE RESTRICT
CONSTRAINT ""FK_People_Employers_EmployerId"" FOREIGN KEY (""EmployerId"") REFERENCES ""Employers"" (""Id"")
);
COMMENT ON TABLE dbo2.""People"" IS 'Table comment';
COMMENT ON COLUMN dbo2.""People"".""EmployerId"" IS 'Employer ID comment';");
......@@ -1004,22 +1004,11 @@ public override async Task Alter_column_change_computed()
public override Task Alter_column_change_computed_type()
=> Assert.ThrowsAsync<NotSupportedException>(() => base.Alter_column_change_computed());
[ConditionalTheory]
[InlineData(true)]
[InlineData(false)]
[InlineData(null)]
public virtual async Task Alter_column_make_non_computed(bool? stored)
public override async Task Alter_column_make_non_computed()
{
if (TestEnvironment.PostgresVersion.IsUnder(12))
{
// await Assert.ThrowsAsync<NotSupportedException>(() => base.Alter_column_make_non_computed());
return;
}
if (stored != true)
{
// Non-stored generated columns aren't yet supported (PG12)
// await Assert.ThrowsAsync<NotSupportedException>(() => base.Alter_column_make_non_computed(stored));
await Assert.ThrowsAsync<NotSupportedException>(() => base.Alter_column_make_non_computed());
return;
}
......@@ -1032,7 +1021,7 @@ public virtual async Task Alter_column_make_non_computed(bool? stored)
e.Property<int>("Y");
}),
builder => builder.Entity("People").Property<int>("Sum")
.HasComputedColumnSql($"{DelimitIdentifier("X")} + {DelimitIdentifier("Y")}", stored: true),
.HasComputedColumnSql(@"""X"" + ""Y""", stored: true),
builder => builder.Entity("People").Property<int>("Sum"),
model =>
{
......@@ -1046,7 +1035,6 @@ public virtual async Task Alter_column_make_non_computed(bool? stored)
@"ALTER TABLE ""People"" DROP COLUMN ""Sum"";",
//
@"ALTER TABLE ""People"" ADD ""Sum"" integer NOT NULL;");
}
public override async Task Alter_column_add_comment()
......@@ -1057,6 +1045,35 @@ public override async Task Alter_column_add_comment()
@"COMMENT ON COLUMN ""People"".""Id"" IS 'Some comment';");
}
public override async Task Alter_computed_column_add_comment()
{
if (TestEnvironment.PostgresVersion.IsUnder(12))
{
await Assert.ThrowsAsync<NotSupportedException>(() => base.Alter_computed_column_add_comment());
return;
}
await Test(
builder => builder.Entity(
"People", x =>
{
x.Property<int>("Id");
x.Property<int>("SomeColumn").HasComputedColumnSql("42", stored: true);
}),
builder => { },
builder => builder.Entity("People").Property<int>("SomeColumn").HasComment("Some comment"),
model =>
{
var table = Assert.Single(model.Tables);
var column = Assert.Single(table.Columns.Where(c => c.Name == "SomeColumn"));
if (AssertComments)
Assert.Equal("Some comment", column.Comment);
});
AssertSql(
@"COMMENT ON COLUMN ""People"".""SomeColumn"" IS 'Some comment';");
}
public override async Task Alter_column_change_comment()
{
await base.Alter_column_change_comment();
......@@ -2065,7 +2082,7 @@ public override async Task Add_foreign_key_with_name()
await base.Add_foreign_key_with_name();
AssertSql(
@"ALTER TABLE ""Orders"" ADD CONSTRAINT ""FK_Foo"" FOREIGN KEY (""CustomerId"") REFERENCES ""Customers"" (""Id"") ON DELETE RESTRICT;");
@"ALTER TABLE ""Orders"" ADD CONSTRAINT ""FK_Foo"" FOREIGN KEY (""CustomerId"") REFERENCES ""Customers"" (""Id"");");
}
public override async Task Drop_foreign_key()
......
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Xunit;
using Xunit.Abstractions;
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Query
......@@ -14,6 +16,10 @@ public NorthwindJoinQueryNpgsqlTest(NorthwindQueryNpgsqlFixture<NoopModelCustomi
//Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper);
}
[ConditionalTheory(Skip = "Test not yet ready")]
public override Task SelectMany_with_client_eval_with_constructor(bool async)
=> base.SelectMany_with_client_eval_with_constructor(async);
protected override void ClearLog()
=> Fixture.TestSqlLoggerFactory.Clear();
}
......
......@@ -266,7 +266,7 @@ public async Task Lateral_join_with_table_is_rewritten_with_subquery()
@"SELECT c.""CustomerID"", c0.""ContactName"", c0.""CustomerID""
FROM ""Customers"" AS c
LEFT JOIN LATERAL (SELECT * FROM ""Customers"") AS c0 ON TRUE
ORDER BY c.""CustomerID"" NULLS FIRST, c0.""CustomerID"" NULLS FIRST");
ORDER BY c.""CustomerID"" NULLS FIRST");
}
protected override void ClearLog()
......
......@@ -188,6 +188,42 @@ public virtual async Task Where_datetime_ctor2(bool async)
WHERE make_timestamp(date_part('year', o.""OrderDate"")::INT, date_part('month', o.""OrderDate"")::INT, 1, 0, 0, 0::double precision) = TIMESTAMP '1996-09-11 00:00:00'");
}
public override Task Where_collection_navigation_ToList_Contains(bool async)
{
var order = new Order { OrderID = 10248 };
return AssertQuery(
async,
ss => ss.Set<Customer>()
.Select(c => c.Orders.OrderBy(o => o.OrderID).ToList())
.Where(e => e.Contains(order)),
entryCount: 5);
}
public override Task Where_collection_navigation_ToArray_Contains(bool async)
{
var order = new Order { OrderID = 10248 };
return AssertQuery(
async,
ss => ss.Set<Customer>()
.Select(c => c.Orders.AsEnumerable().OrderBy(o => o.OrderID).ToArray())
.Where(e => e.Contains(order)),
entryCount: 5);
}
public override Task Where_collection_navigation_AsEnumerable_Contains(bool async)
{
var order = new Order { OrderID = 10248 };
return AssertQuery(
async,
ss => ss.Set<Customer>()
.Select(c => c.Orders.OrderBy(o => o.OrderID).AsEnumerable())
.Where(e => e.Contains(order)),
entryCount: 5);
}
private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);
......
......@@ -22,7 +22,7 @@ static TestEnvironment()
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
}
private const string DefaultConnectionString = "Server=localhost;Username=npgsql_tests;Password=npgsql_tests";
private const string DefaultConnectionString = "Server=localhost;Username=npgsql_tests;Password=npgsql_tests;Port=5434";
public static string DefaultConnection => Config["DefaultConnection"] ?? DefaultConnectionString;
......
using System.Linq;
using System;
using System.Linq;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Scaffolding;
using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure;
using Npgsql.EntityFrameworkCore.PostgreSQL.Scaffolding.Internal;
using Xunit;
......@@ -31,7 +35,7 @@ public virtual void Use_provider_method_is_generated_correctly_with_options()
new ProviderCodeGeneratorDependencies(
Enumerable.Empty<IProviderCodeGeneratorPlugin>()));
var providerOptions = new MethodCallCodeFragment("SetProviderOption");
var providerOptions = new MethodCallCodeFragment(_setProviderOptionMethodInfo);
var result = codeGenerator.GenerateUseProvider("Server=test;Username=test;Password=test;Database=test", providerOptions);
......@@ -48,5 +52,11 @@ public virtual void Use_provider_method_is_generated_correctly_with_options()
});
Assert.Null(result.ChainedCall);
}
private static readonly MethodInfo _setProviderOptionMethodInfo
= typeof(NpgsqlCodeGeneratorTest).GetRuntimeMethod(nameof(SetProviderOption), new[] { typeof(DbContextOptionsBuilder) });
public static NpgsqlDbContextOptionsBuilder SetProviderOption(DbContextOptionsBuilder optionsBuilder)
=> throw new NotSupportedException();
}
}
......@@ -31,8 +31,8 @@ public class FakeRelationalCommandDiagnosticsLogger
Guid commandId,
Guid connectionId,
DateTimeOffset startTime,
CommandSource commandSource,
TimeSpan duration)
TimeSpan duration,
CommandSource commandSource)
=> command;
public InterceptionResult<DbDataReader> CommandReaderExecuting(
......@@ -106,8 +106,8 @@ public class FakeRelationalCommandDiagnosticsLogger
Guid connectionId,
DbDataReader methodResult,
DateTimeOffset startTime,
CommandSource commandSource,
TimeSpan duration)
TimeSpan duration,
CommandSource commandSource)
=> methodResult;
public object? CommandScalarExecuted(
......@@ -118,8 +118,8 @@ public class FakeRelationalCommandDiagnosticsLogger
Guid connectionId,
object? methodResult,
DateTimeOffset startTime,
CommandSource commandSource,
TimeSpan duration)
TimeSpan duration,
CommandSource commandSource)
=> methodResult;
public int CommandNonQueryExecuted(
......@@ -130,8 +130,8 @@ public class FakeRelationalCommandDiagnosticsLogger
Guid connectionId,
int methodResult,
DateTimeOffset startTime,
CommandSource commandSource,
TimeSpan duration)
TimeSpan duration,
CommandSource commandSource)
=> methodResult;
public ValueTask<DbDataReader> CommandReaderExecutedAsync(
......@@ -142,8 +142,8 @@ public class FakeRelationalCommandDiagnosticsLogger
Guid connectionId,
DbDataReader methodResult,
DateTimeOffset startTime,
CommandSource commandSource,
TimeSpan duration,
CommandSource commandSource,
CancellationToken cancellationToken = default)
=> new(methodResult);
......@@ -155,8 +155,8 @@ public class FakeRelationalCommandDiagnosticsLogger
Guid connectionId,
object? methodResult,
DateTimeOffset startTime,
CommandSource commandSource,
TimeSpan duration,
CommandSource commandSource,
CancellationToken cancellationToken = default)
=> new(methodResult);
......@@ -168,8 +168,8 @@ public class FakeRelationalCommandDiagnosticsLogger
Guid connectionId,
int methodResult,
DateTimeOffset startTime,
CommandSource commandSource,
TimeSpan duration,
CommandSource commandSource,
CancellationToken cancellationToken = default)
=> new(methodResult);
......@@ -182,8 +182,8 @@ public class FakeRelationalCommandDiagnosticsLogger
Guid connectionId,
Exception exception,
DateTimeOffset startTime,
CommandSource commandSource,
TimeSpan duration)
TimeSpan duration,
CommandSource commandSource)
{
}
......@@ -196,8 +196,8 @@ public class FakeRelationalCommandDiagnosticsLogger
Guid connectionId,
Exception exception,
DateTimeOffset startTime,
CommandSource commandSource,
TimeSpan duration,
CommandSource commandSource,
CancellationToken cancellationToken = default)
=> Task.CompletedTask;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册