这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<VersionPrefix>9.0.0-preview.1</VersionPrefix>
<LangVersion>preview</LangVersion>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AnalysisLevel>latest</AnalysisLevel>
<NoWarn>NU5105</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,10 @@ public virtual void Validate(IDbContextOptions options)
}
}

private sealed class ExtensionInfo : DbContextOptionsExtensionInfo
private sealed class ExtensionInfo(IDbContextOptionsExtension extension) : DbContextOptionsExtensionInfo(extension)
{
private string? _logFragment;

public ExtensionInfo(IDbContextOptionsExtension extension)
: base(extension)
{
}

private new NpgsqlNetTopologySuiteOptionsExtension Extension
=> (NpgsqlNetTopologySuiteOptionsExtension)base.Extension;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,8 @@ public virtual void Validate(IDbContextOptions options)
}
}

private sealed class ExtensionInfo : DbContextOptionsExtensionInfo
private sealed class ExtensionInfo(IDbContextOptionsExtension extension) : DbContextOptionsExtensionInfo(extension)
{
public ExtensionInfo(IDbContextOptionsExtension extension)
: base(extension)
{
}

private new NpgsqlNodaTimeOptionsExtension Extension
=> (NpgsqlNodaTimeOptionsExtension)base.Extension;

Expand Down
24 changes: 6 additions & 18 deletions src/EFCore.PG.NodaTime/Storage/Internal/DateTimeZoneMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,11 @@ public override Expression GenerateCodeLiteral(object value)
typeof(IDateTimeZoneProvider).GetMethod(nameof(IDateTimeZoneProvider.GetZoneOrNull), new[] { typeof(string) })!,
Expression.Constant(((DateTimeZone)value).Id));

private sealed class DateTimeZoneConverter : ValueConverter<DateTimeZone, string>
{
public DateTimeZoneConverter()
: base(
tz => tz.Id,
id => DateTimeZoneProviders.Tzdb[id])
{
}
}
private sealed class DateTimeZoneConverter() : ValueConverter<DateTimeZone, string>(
tz => tz.Id,
id => DateTimeZoneProviders.Tzdb[id]);

private sealed class DateTimeZoneComparer : ValueComparer<DateTimeZone>
{
public DateTimeZoneComparer()
: base(
(tz1, tz2) => tz1 == null ? tz2 == null : tz2 != null && tz1.Id == tz2.Id,
tz => tz.GetHashCode())
{
}
}
private sealed class DateTimeZoneComparer() : ValueComparer<DateTimeZone>(
(tz1, tz2) => tz1 == null ? tz2 == null : tz2 != null && tz1.Id == tz2.Id,
tz => tz.GetHashCode());
}
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,11 @@ public override void ApplyServices(IServiceCollection services)
public override DbContextOptionsExtensionInfo Info
=> _info ??= new ExtensionInfo(this);

private sealed class ExtensionInfo : RelationalExtensionInfo
private sealed class ExtensionInfo(IDbContextOptionsExtension extension) : RelationalExtensionInfo(extension)
{
private int? _serviceProviderHash;
private string? _logFragment;

public ExtensionInfo(IDbContextOptionsExtension extension)
: base(extension)
{
}

private new NpgsqlOptionsExtension Extension
=> (NpgsqlOptionsExtension)base.Extension;

Expand Down
21 changes: 6 additions & 15 deletions src/EFCore.PG/Migrations/NpgsqlMigrationsSqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2217,22 +2217,13 @@ private static IndexColumn[] GetIndexColumns(CreateIndexOperation operation)
return columns;
}

private readonly struct IndexColumn
private readonly struct IndexColumn(string name, string? @operator, string? collation, bool isDescending, NullSortOrder nullSortOrder)
{
public IndexColumn(string name, string? @operator, string? collation, bool isDescending, NullSortOrder nullSortOrder)
{
Name = name;
Operator = @operator;
Collation = collation;
IsDescending = isDescending;
NullSortOrder = nullSortOrder;
}

public string Name { get; }
public string? Operator { get; }
public string? Collation { get; }
public bool IsDescending { get; }
public NullSortOrder NullSortOrder { get; }
public string Name { get; } = name;
public string? Operator { get; } = @operator;
public string? Collation { get; } = collation;
public bool IsDescending { get; } = isDescending;
public NullSortOrder NullSortOrder { get; } = nullSortOrder;
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,12 @@ public override object GenerateCacheKey(Expression query, bool async)
GenerateCacheKeyCore(query, async),
RelationalDependencies.ContextOptions.FindExtension<NpgsqlOptionsExtension>()?.ReverseNullOrdering ?? false);

private struct NpgsqlCompiledQueryCacheKey
private struct NpgsqlCompiledQueryCacheKey(
RelationalCompiledQueryCacheKey relationalCompiledQueryCacheKey,
bool reverseNullOrdering)
{
private readonly RelationalCompiledQueryCacheKey _relationalCompiledQueryCacheKey;
private readonly bool _reverseNullOrdering;

public NpgsqlCompiledQueryCacheKey(
RelationalCompiledQueryCacheKey relationalCompiledQueryCacheKey,
bool reverseNullOrdering)
{
_relationalCompiledQueryCacheKey = relationalCompiledQueryCacheKey;
_reverseNullOrdering = reverseNullOrdering;
}
private readonly RelationalCompiledQueryCacheKey _relationalCompiledQueryCacheKey = relationalCompiledQueryCacheKey;
private readonly bool _reverseNullOrdering = reverseNullOrdering;

public override bool Equals(object? obj)
=> !(obj is null)
Expand Down
10 changes: 2 additions & 8 deletions src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1516,16 +1516,10 @@ private void GenerateList<T>(
}
}

private sealed class OuterReferenceFindingExpressionVisitor : ExpressionVisitor
private sealed class OuterReferenceFindingExpressionVisitor(TableExpression mainTable) : ExpressionVisitor
{
private readonly TableExpression _mainTable;
private bool _containsReference;

public OuterReferenceFindingExpressionVisitor(TableExpression mainTable)
{
_mainTable = mainTable;
}

public bool ContainsReferenceToMainTable(SqlExpression sqlExpression)
{
_containsReference = false;
Expand All @@ -1544,7 +1538,7 @@ public bool ContainsReferenceToMainTable(SqlExpression sqlExpression)
}

if (expression is ColumnExpression columnExpression
&& columnExpression.Table == _mainTable)
&& columnExpression.Table == mainTable)
{
_containsReference = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1258,16 +1258,10 @@ private SqlExpression GetArray(TableExpressionBase tableExpression)
}
}

private sealed class OuterReferenceFindingExpressionVisitor : ExpressionVisitor
private sealed class OuterReferenceFindingExpressionVisitor(TableExpression mainTable) : ExpressionVisitor
{
private readonly TableExpression _mainTable;
private bool _containsReference;

public OuterReferenceFindingExpressionVisitor(TableExpression mainTable)
{
_mainTable = mainTable;
}

public bool ContainsReferenceToMainTable(TableExpressionBase tableExpression)
{
_containsReference = false;
Expand All @@ -1286,7 +1280,7 @@ public bool ContainsReferenceToMainTable(TableExpressionBase tableExpression)
}

if (expression is ColumnExpression columnExpression
&& columnExpression.Table == _mainTable)
&& columnExpression.Table == mainTable)
{
_containsReference = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1297,14 +1297,9 @@ private static SequenceInfo ReadSequenceInfo(DbDataRecord record, Version postgr
};
}

private sealed class SequenceInfo
private sealed class SequenceInfo(string storeType)
{
public SequenceInfo(string storeType)
{
StoreType = storeType;
}

public string StoreType { get; }
public string StoreType { get; } = storeType;
public long? StartValue { get; set; }
public long? MinValue { get; set; }
public long? MaxValue { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,11 @@ protected override string GenerateNonNullSqlLiteral(object value)
$"CLR type must be {nameof(Dictionary<string, string>)} or {nameof(ImmutableDictionary<string, string>)}");
}

private sealed class HstoreMutableComparer : ValueComparer<Dictionary<string, string>>
private sealed class HstoreMutableComparer() : ValueComparer<Dictionary<string, string>>(
(a, b) => Compare(a, b),
o => o.GetHashCode(),
o => new Dictionary<string, string>(o))
{
public HstoreMutableComparer()
: base(
(a, b) => Compare(a, b),
o => o.GetHashCode(),
o => new Dictionary<string, string>(o))
{
}

private static bool Compare(Dictionary<string, string>? a, Dictionary<string, string>? b)
{
if (a is null)
Expand Down
Loading