V10: fix build warnings infrastructure (#12369)

* Run code cleanup

* Run dotnet format

* Start manual fixes

* Manual fixing of warnings

* Fix nullability in columnalias

* Fix tests

* Fix up after merge

* Start updating after review

* Update editorconfig to contain new static & const rules

* Fix up editorconfig to not contain duplicate rules

* Fix up static member names

* Fix up according to review

* Update src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.DistributedCache.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Repositories.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Repositories.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Examine/ContentIndexPopulator.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Examine/ContentIndexPopulator.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Examine/ContentValueSetValidator.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Examine/ContentValueSetValidator.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Examine/ContentValueSetValidator.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Examine/ExamineUmbracoIndexingHandler.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Examine/PublishedContentIndexPopulator.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Extensions/InstanceIdentifiableExtensions.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/HostedServices/ReportSiteTask.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Macros/MacroTagParser.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Macros/MacroTagParser.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Macros/MacroTagParser.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Migrations/Expressions/Alter/Table/IAlterTableColumnOptionBuilder.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Migrations/Upgrade/V_10_0_0/AddMemberPropertiesAsColumns.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/Dtos/ExternalLoginDto.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/Mappers/AccessMapper.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/Mappers/AuditEntryMapper.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/Mappers/MediaMapper.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/Mappers/MemberMapper.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/Mappers/PropertyGroupMapper.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/Mappers/PropertyGroupMapper.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/Mappers/PropertyTypeMapper.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/Mappers/PropertyTypeMapper.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/Mappers/RelationTypeMapper.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/Mappers/RelationTypeMapper.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/NPocoMapperCollectionBuilder.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/Querying/ExpressionVisitorBase.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Fix [..] to substring

* Fix after merge with 10/dev

* Fox ContentValueSetValidator.cs

* Update LoggerConfigExtensions

Co-authored-by: Nikolaj Geisle <niko737@edu.ucl.dk>
Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
This commit is contained in:
Nikolaj Geisle
2022-06-02 08:18:31 +02:00
committed by GitHub
parent adcc9a0e1f
commit f4e333c178
838 changed files with 64052 additions and 61173 deletions

View File

@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
using NPoco;
using Umbraco.Cms.Core.Cache;
@@ -10,87 +7,81 @@ using Umbraco.Cms.Infrastructure.Persistence.Querying;
using Umbraco.Cms.Infrastructure.Scoping;
using Umbraco.Extensions;
namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement;
// TODO: Obsolete this, change all implementations of this like in Dictionary to just use custom Cache policies like in the member repository.
/// <summary>
/// Simple abstract ReadOnly repository used to simply have PerformGet and PeformGetAll with an underlying cache
/// </summary>
internal abstract class SimpleGetRepository<TId, TEntity, TDto> : EntityRepositoryBase<TId, TEntity>
where TEntity : class, IEntity
where TDto : class
{
// TODO: Obsolete this, change all implementations of this like in Dictionary to just use custom Cache policies like in the member repository.
/// <summary>
/// Simple abstract ReadOnly repository used to simply have PerformGet and PeformGetAll with an underlying cache
/// </summary>
internal abstract class SimpleGetRepository<TId, TEntity, TDto> : EntityRepositoryBase<TId, TEntity>
where TEntity : class, IEntity
where TDto: class
protected SimpleGetRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger<SimpleGetRepository<TId, TEntity, TDto>> logger)
: base(scopeAccessor, cache, logger)
{
protected SimpleGetRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger<SimpleGetRepository<TId, TEntity, TDto>> logger)
: base(scopeAccessor, cache, logger)
{ }
protected abstract TEntity ConvertToEntity(TDto dto);
protected abstract object GetBaseWhereClauseArguments(TId? id);
protected abstract string GetWhereInClauseForGetAll();
protected virtual IEnumerable<TDto> PerformFetch(Sql sql)
{
return Database.Fetch<TDto>(sql);
}
protected override TEntity? PerformGet(TId? id)
{
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), GetBaseWhereClauseArguments(id));
var dto = PerformFetch(sql).FirstOrDefault();
if (dto == null)
return null;
var entity = ConvertToEntity(dto);
if (entity is EntityBase dirtyEntity)
{
// reset dirty initial properties (U4-1946)
dirtyEntity.ResetDirtyProperties(false);
}
return entity;
}
protected override IEnumerable<TEntity> PerformGetAll(params TId[]? ids)
{
var sql = Sql().From<TEntity>();
if (ids?.Any() ?? false)
{
sql.Where(GetWhereInClauseForGetAll(), new { /*ids =*/ ids });
}
return Database.Fetch<TDto>(sql).Select(ConvertToEntity);
}
protected sealed override IEnumerable<TEntity> PerformGetByQuery(IQuery<TEntity> query)
{
var sqlClause = GetBaseQuery(false);
var translator = new SqlTranslator<TEntity>(sqlClause, query);
var sql = translator.Translate();
return Database.Fetch<TDto>(sql).Select(ConvertToEntity);
}
#region Not implemented and not required
protected sealed override IEnumerable<string> GetDeleteClauses()
{
throw new InvalidOperationException("This method won't be implemented.");
}
protected sealed override void PersistNewItem(TEntity entity)
{
throw new InvalidOperationException("This method won't be implemented.");
}
protected sealed override void PersistUpdatedItem(TEntity entity)
{
throw new InvalidOperationException("This method won't be implemented.");
}
#endregion
}
protected abstract TEntity ConvertToEntity(TDto dto);
protected abstract object GetBaseWhereClauseArguments(TId? id);
protected abstract string GetWhereInClauseForGetAll();
protected virtual IEnumerable<TDto> PerformFetch(Sql sql) => Database.Fetch<TDto>(sql);
protected override TEntity? PerformGet(TId? id)
{
Sql<ISqlContext> sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), GetBaseWhereClauseArguments(id));
TDto? dto = PerformFetch(sql).FirstOrDefault();
if (dto == null)
{
return null;
}
TEntity entity = ConvertToEntity(dto);
if (entity is EntityBase dirtyEntity)
{
// reset dirty initial properties (U4-1946)
dirtyEntity.ResetDirtyProperties(false);
}
return entity;
}
protected override IEnumerable<TEntity> PerformGetAll(params TId[]? ids)
{
Sql<ISqlContext> sql = Sql().From<TEntity>();
if (ids?.Any() ?? false)
{
sql.Where(GetWhereInClauseForGetAll(), new
{
ids,
});
}
return Database.Fetch<TDto>(sql).Select(ConvertToEntity);
}
protected sealed override IEnumerable<TEntity> PerformGetByQuery(IQuery<TEntity> query)
{
Sql<ISqlContext> sqlClause = GetBaseQuery(false);
var translator = new SqlTranslator<TEntity>(sqlClause, query);
Sql<ISqlContext> sql = translator.Translate();
return Database.Fetch<TDto>(sql).Select(ConvertToEntity);
}
protected sealed override IEnumerable<string> GetDeleteClauses() =>
throw new InvalidOperationException("This method won't be implemented.");
protected sealed override void PersistNewItem(TEntity entity) =>
throw new InvalidOperationException("This method won't be implemented.");
protected sealed override void PersistUpdatedItem(TEntity entity) =>
throw new InvalidOperationException("This method won't be implemented.");
}