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

Use concrete types when possible for improved performance #15190

Merged
merged 1 commit into from
Jan 29, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private async Task<IDisplayResult> BuildViewModelAsync(string containerId, strin
return Combine(results);
}

private IDisplayResult GetListPartHeader(ContentItem containerContentItem, ListPartSettings listPartSettings)
private ShapeResult GetListPartHeader(ContentItem containerContentItem, ListPartSettings listPartSettings)
=> Initialize<ListPartHeaderAdminViewModel>("ListPartHeaderAdmin", async model =>
{
model.ContainerContentItem = containerContentItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ connection is SqliteConnection sqliteConnection &&
return DbConnectionValidatorResult.DocumentTableFound;
}

private static ISqlBuilder GetSelectBuilderForDocumentTable(ISqlBuilder sqlBuilder, string documentTable, string schema)
private static SqlBuilder GetSelectBuilderForDocumentTable(SqlBuilder sqlBuilder, string documentTable, string schema)
{
sqlBuilder.Select();
sqlBuilder.Selector("*");
Expand All @@ -174,7 +174,7 @@ private static ISqlBuilder GetSelectBuilderForDocumentTable(ISqlBuilder sqlBuild
return sqlBuilder;
}

private static ISqlBuilder GetSelectBuilderForShellDescriptorDocument(ISqlBuilder sqlBuilder, string documentTable, string schema)
private static SqlBuilder GetSelectBuilderForShellDescriptorDocument(SqlBuilder sqlBuilder, string documentTable, string schema)
{
sqlBuilder.Select();
sqlBuilder.Selector("*");
Expand Down Expand Up @@ -209,7 +209,7 @@ private static ISqlDialect GetSqlDialect(string databaseProvider)
};
}

private static ISqlBuilder GetSqlBuilder(ISqlDialect sqlDialect, string tablePrefix, string tableNameSeparator)
private static SqlBuilder GetSqlBuilder(ISqlDialect sqlDialect, string tablePrefix, string tableNameSeparator)
{
var prefix = string.Empty;
if (!string.IsNullOrWhiteSpace(tablePrefix))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public async Task UpdateAsync(string featureId)
/// <summary>
/// Returns all the available IDataMigration instances for a specific module, and inject necessary builders
/// </summary>
private IEnumerable<IDataMigration> GetDataMigrations(string featureId)
private List<IDataMigration> GetDataMigrations(string featureId)
{
var migrations = _dataMigrations
.Where(dm => _typeFeatureProvider.GetFeatureForDependency(dm.GetType()).Id == featureId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ShapeAlterationBuilder
private IFeatureInfo _feature;
private readonly string _shapeType;
private readonly string _bindingName;
private readonly IList<Action<ShapeDescriptor>> _configurations = new List<Action<ShapeDescriptor>>();
private readonly List<Action<ShapeDescriptor>> _configurations = [];

public ShapeAlterationBuilder(IFeatureInfo feature, string shapeType)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public IEnumerable<CommandDescriptor> GetCommandDescriptors()
return _commandHandlers.SelectMany(x => _builder.Build(x.GetType()).Commands);
}

private IEnumerable<Match> MatchCommands(CommandParameters parameters)
private List<Match> MatchCommands(CommandParameters parameters)
{
// Commands are matched with arguments. first argument
// is the command others are arguments to the command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private IEnumerable<IFeatureInfo> GetFeaturesToEnable(IFeatureInfo featureInfo,
/// <param name="enabledFeatureIds">The list of feature ids which are currently enabled.</param>
/// <param name="force">Boolean parameter indicating if the feature should disable it's dependents.</param>
/// <returns>An enumeration of the features to enable, empty if 'force' = true and a dependent is enabled</returns>
private IEnumerable<IFeatureInfo> GetFeaturesToDisable(IFeatureInfo featureInfo, IEnumerable<string> enabledFeatureIds, bool force)
private List<IFeatureInfo> GetFeaturesToDisable(IFeatureInfo featureInfo, IEnumerable<string> enabledFeatureIds, bool force)
{
var featuresToDisable = _extensionManager
.GetDependentFeatures(featureInfo.Id)
Expand All @@ -204,7 +204,7 @@ private IEnumerable<IFeatureInfo> GetFeaturesToDisable(IFeatureInfo featureInfo,
_logger.LogWarning(" To disable '{FeatureId}', additional features need to be disabled.", featureInfo.Id);
}

return Enumerable.Empty<IFeatureInfo>();
return [];
}

return featuresToDisable;
Expand Down
Loading