Skip to content

Commit

Permalink
Use concrete types when possible for improved performance (#15190)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek committed Jan 29, 2024
1 parent deec515 commit a98cf34
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
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

0 comments on commit a98cf34

Please sign in to comment.