Update to .NET 6 and C# 10 (#5233)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
committed by
GitHub
parent
29f3d2d1ca
commit
af579b15cc
@@ -33,7 +33,12 @@ namespace Content.Server.Database
|
||||
|
||||
public override string LogFragment => "Snake Case Extension";
|
||||
|
||||
public override long GetServiceProviderHashCode() => 0;
|
||||
public override int GetServiceProviderHashCode() => 0;
|
||||
|
||||
public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PopulateDebugInfo(IDictionary<string, string> debugInfo)
|
||||
{
|
||||
@@ -118,26 +123,26 @@ namespace Content.Server.Database
|
||||
|
||||
if (entityType.BaseType is null)
|
||||
{
|
||||
entityTypeBuilder.ToTable(RewriteName(entityType.GetTableName()), entityType.GetSchema());
|
||||
entityTypeBuilder.ToTable(RewriteName(entityType.GetTableName()!), entityType.GetSchema());
|
||||
|
||||
if (entityType.GetViewNameConfigurationSource() == ConfigurationSource.Convention)
|
||||
{
|
||||
entityTypeBuilder.ToView(RewriteName(entityType.GetViewName()), entityType.GetViewSchema());
|
||||
entityTypeBuilder.ToView(RewriteName(entityType.GetViewName()!), entityType.GetViewSchema());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ProcessEntityTypeBaseTypeChanged(
|
||||
IConventionEntityTypeBuilder entityTypeBuilder,
|
||||
IConventionEntityType newBaseType,
|
||||
IConventionEntityType oldBaseType,
|
||||
IConventionEntityType? newBaseType,
|
||||
IConventionEntityType? oldBaseType,
|
||||
IConventionContext<IConventionEntityType> context)
|
||||
{
|
||||
var entityType = entityTypeBuilder.Metadata;
|
||||
|
||||
if (newBaseType is null)
|
||||
{
|
||||
entityTypeBuilder.ToTable(RewriteName(entityType.GetTableName()), entityType.GetSchema());
|
||||
entityTypeBuilder.ToTable(RewriteName(entityType.GetTableName()!), entityType.GetSchema());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -173,8 +178,8 @@ namespace Content.Server.Database
|
||||
public void ProcessEntityTypeAnnotationChanged(
|
||||
IConventionEntityTypeBuilder entityTypeBuilder,
|
||||
string name,
|
||||
IConventionAnnotation annotation,
|
||||
IConventionAnnotation oldAnnotation,
|
||||
IConventionAnnotation? annotation,
|
||||
IConventionAnnotation? oldAnnotation,
|
||||
IConventionContext<IConventionAnnotation> context)
|
||||
{
|
||||
var entityType = entityTypeBuilder.Metadata;
|
||||
@@ -216,7 +221,7 @@ namespace Content.Server.Database
|
||||
&& (string)annotation.Value != ownership.PrincipalEntityType.GetTableName())
|
||||
{
|
||||
foreach (var property in entityType.GetProperties()
|
||||
.Except(entityType.FindPrimaryKey().Properties)
|
||||
.Except(entityType.FindPrimaryKey()!.Properties)
|
||||
.Where(p => p.Builder.CanSetColumnName(null)))
|
||||
{
|
||||
RewriteColumnName(property.Builder);
|
||||
@@ -271,7 +276,7 @@ namespace Content.Server.Database
|
||||
|
||||
if (property.GetColumnNameConfigurationSource(identifier.Value) == ConfigurationSource.Convention)
|
||||
{
|
||||
columnName = property.GetColumnName(identifier.Value);
|
||||
columnName = property.GetColumnName(identifier.Value)!;
|
||||
if (columnName.StartsWith(entityType.ShortName() + '_', StringComparison.Ordinal))
|
||||
{
|
||||
property.Builder.HasColumnName(
|
||||
@@ -314,7 +319,7 @@ namespace Content.Server.Database
|
||||
if (name == "Id")
|
||||
name = entityType.GetTableName() + name;
|
||||
propertyBuilder.HasColumnName(
|
||||
RewriteName(name), identifier.Value);
|
||||
RewriteName(name!), identifier.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user