Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More precise index scaffolding warning #3989

Merged
merged 1 commit into from
Dec 9, 2015
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
More precise index scaffolding warning
Missing property is only one reason for failing to scaffold an index.
Providers may override VisitIndex and return null for other reasons, in
which case it's their responsibility to log a warning.
  • Loading branch information
roji committed Dec 9, 2015
commit 503095e6480df6829aa6942a44b9775e8cbe300b

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
<data name="UnableToGenerateEntityType" xml:space="preserve">
<value>Unable to generate entity type for table '{tableName}'.</value>
</data>
<data name="UnableToScaffoldIndex" xml:space="preserve">
<data name="UnableToScaffoldIndexMissingProperty" xml:space="preserve">
<value>Unable to scaffold the index '{indexName}' because at least one of the properties it contains could not be scaffolded.</value>
</data>
<data name="MissingUseProviderMethodNameAnnotation" xml:space="preserve">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,7 @@ protected virtual EntityTypeBuilder VisitIndexes([NotNull] EntityTypeBuilder bui

foreach (var index in indexes)
{
var indexBuilder = VisitIndex(builder, index);

if (indexBuilder == null)
{
Logger.LogWarning(RelationalDesignStrings.UnableToScaffoldIndex(index.Name));
}
VisitIndex(builder, index);
}

return builder;
Expand All @@ -283,7 +278,7 @@ protected virtual IndexBuilder VisitIndex([NotNull] EntityTypeBuilder builder, [

if (properties.Count(p => builder.Metadata.FindProperty(p) != null) != properties.Length)
{
// TODO log when index cannot be scaffolding because of missing columns
Logger.LogWarning(RelationalDesignStrings.UnableToScaffoldIndexMissingProperty(index.Name));
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void E2ETest_UseAttributesInsteadOfFluentApi()
RelationalDesignStrings.CannotFindTypeMappingForColumn("dbo.AllDataTypes.hierarchyidColumn", "hierarchyid"),
RelationalDesignStrings.CannotFindTypeMappingForColumn("dbo.AllDataTypes.sql_variantColumn", "sql_variant"),
RelationalDesignStrings.CannotFindTypeMappingForColumn("dbo.AllDataTypes.xmlColumn", "xml"),
RelationalDesignStrings.UnableToScaffoldIndex("IX_UnscaffoldableIndex"),
RelationalDesignStrings.UnableToScaffoldIndexMissingProperty("IX_UnscaffoldableIndex"),
SqlServerDesignStrings.DataTypeDoesNotAllowSqlServerIdentityStrategy("dbo.PropertyConfiguration.PropertyConfigurationID","tinyint"),
RelationalDesignStrings.CannotFindTypeMappingForColumn("dbo.TableWithUnmappablePrimaryKeyColumn.TableWithUnmappablePrimaryKeyColumnID", "hierarchyid"),
RelationalDesignStrings.PrimaryKeyErrorPropertyNotFound("dbo.TableWithUnmappablePrimaryKeyColumn"),
Expand Down Expand Up @@ -191,7 +191,7 @@ public void E2ETest_AllFluentApi()
RelationalDesignStrings.CannotFindTypeMappingForColumn("dbo.AllDataTypes.hierarchyidColumn", "hierarchyid"),
RelationalDesignStrings.CannotFindTypeMappingForColumn("dbo.AllDataTypes.sql_variantColumn", "sql_variant"),
RelationalDesignStrings.CannotFindTypeMappingForColumn("dbo.AllDataTypes.xmlColumn", "xml"),
RelationalDesignStrings.UnableToScaffoldIndex("IX_UnscaffoldableIndex"),
RelationalDesignStrings.UnableToScaffoldIndexMissingProperty("IX_UnscaffoldableIndex"),
SqlServerDesignStrings.DataTypeDoesNotAllowSqlServerIdentityStrategy("dbo.PropertyConfiguration.PropertyConfigurationID","tinyint"),
RelationalDesignStrings.CannotFindTypeMappingForColumn("dbo.TableWithUnmappablePrimaryKeyColumn.TableWithUnmappablePrimaryKeyColumnID", "hierarchyid"),
RelationalDesignStrings.PrimaryKeyErrorPropertyNotFound("dbo.TableWithUnmappablePrimaryKeyColumn"),
Expand Down