Skip to content

Commit

Permalink
Remove provider prefix from builder metadata extension method
Browse files Browse the repository at this point in the history
Closes #942
Follows dotnet/efcore#16686
  • Loading branch information
roji committed Jul 26, 2019
1 parent ef86b35 commit 4d34263
Show file tree
Hide file tree
Showing 21 changed files with 616 additions and 163 deletions.
28 changes: 14 additions & 14 deletions src/EFCore.PG/Design/Internal/NpgsqlAnnotationCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public override MethodCallCodeFragment GenerateFluentApi(IModel model, IAnnotati
var enumTypeDef = new PostgresEnum(model, annotation.Name);

return enumTypeDef.Schema == "public"
? new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.ForNpgsqlHasEnum),
? new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresEnum),
enumTypeDef.Name, enumTypeDef.Labels)
: new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.ForNpgsqlHasEnum),
: new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresEnum),
enumTypeDef.Schema, enumTypeDef.Name, enumTypeDef.Labels);
}

Expand All @@ -95,13 +95,13 @@ public override MethodCallCodeFragment GenerateFluentApi(IModel model, IAnnotati
rangeTypeDef.Collation == null &&
rangeTypeDef.SubtypeDiff == null)
{
return new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.ForNpgsqlHasRange),
return new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresRange),
rangeTypeDef.Schema == "public" ? null : rangeTypeDef.Schema,
rangeTypeDef.Name,
rangeTypeDef.Subtype);
}

return new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.ForNpgsqlHasRange),
return new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresRange),
rangeTypeDef.Schema == "public" ? null : rangeTypeDef.Schema,
rangeTypeDef.Name,
rangeTypeDef.Subtype,
Expand All @@ -123,7 +123,7 @@ public override MethodCallCodeFragment GenerateFluentApi(IEntityType entityType,
return new MethodCallCodeFragment(nameof(NpgsqlEntityTypeBuilderExtensions.ForNpgsqlHasComment), annotation.Value);

if (annotation.Name == NpgsqlAnnotationNames.UnloggedTable)
return new MethodCallCodeFragment(nameof(NpgsqlEntityTypeBuilderExtensions.ForNpgsqlIsUnlogged), annotation.Value);
return new MethodCallCodeFragment(nameof(NpgsqlEntityTypeBuilderExtensions.IsUnlogged), annotation.Value);

return null;
}
Expand All @@ -139,11 +139,11 @@ public override MethodCallCodeFragment GenerateFluentApi(IProperty property, IAn
switch ((NpgsqlValueGenerationStrategy)annotation.Value)
{
case NpgsqlValueGenerationStrategy.SerialColumn:
return new MethodCallCodeFragment(nameof(NpgsqlPropertyBuilderExtensions.ForNpgsqlUseSerialColumn));
return new MethodCallCodeFragment(nameof(NpgsqlPropertyBuilderExtensions.UseSerialColumn));
case NpgsqlValueGenerationStrategy.IdentityAlwaysColumn:
return new MethodCallCodeFragment(nameof(NpgsqlPropertyBuilderExtensions.ForNpgsqlUseIdentityAlwaysColumn));
return new MethodCallCodeFragment(nameof(NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn));
case NpgsqlValueGenerationStrategy.IdentityByDefaultColumn:
return new MethodCallCodeFragment(nameof(NpgsqlPropertyBuilderExtensions.ForNpgsqlUseIdentityByDefaultColumn));
return new MethodCallCodeFragment(nameof(NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn));
case NpgsqlValueGenerationStrategy.SequenceHiLo:
throw new Exception($"Unexpected {NpgsqlValueGenerationStrategy.SequenceHiLo} value generation strategy when scaffolding");
default:
Expand All @@ -160,17 +160,17 @@ public override MethodCallCodeFragment GenerateFluentApi(IProperty property, IAn
public override MethodCallCodeFragment GenerateFluentApi(IIndex index, IAnnotation annotation)
{
if (annotation.Name == NpgsqlAnnotationNames.IndexMethod)
return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.ForNpgsqlHasMethod), annotation.Value);
return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasMethod), annotation.Value);
if (annotation.Name == NpgsqlAnnotationNames.IndexOperators)
return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.ForNpgsqlHasOperators), annotation.Value);
return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasOperators), annotation.Value);
if (annotation.Name == NpgsqlAnnotationNames.IndexCollation)
return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.ForNpgsqlHasCollation), annotation.Value);
return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasCollation), annotation.Value);
if (annotation.Name == NpgsqlAnnotationNames.IndexSortOrder)
return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.ForNpgsqlHasSortOrder), annotation.Value);
return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasSortOrder), annotation.Value);
if (annotation.Name == NpgsqlAnnotationNames.IndexNullSortOrder)
return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.ForNpgsqlHasNullSortOrder), annotation.Value);
return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasNullSortOrder), annotation.Value);
if (annotation.Name == NpgsqlAnnotationNames.IndexInclude)
return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.ForNpgsqlInclude), annotation.Value);
return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.IncludeProperties), annotation.Value);

return null;
}
Expand Down
Loading

0 comments on commit 4d34263

Please sign in to comment.