Migration to net 6 - not working for now

This commit is contained in:
Roland Fieger
2021-10-14 16:53:06 +02:00
parent e9d30aad16
commit f8c6316d4e
13 changed files with 167 additions and 103 deletions

View File

@@ -27,7 +27,7 @@ namespace BusinessLogic.LookupLogic
public async Task<DataResult<List<LookupCategory>>> GetAllLookups()
{
var result = await _lookupRepo.GetAllLookups();
_logger.LogInformation($"Call to GetAllLookups ended with {nameof(result.GeneralResult)}");
_logger.LogInformation($"Call to GetAllLookups ended with {result.GeneralResult.ToString()}");
return result;
}

View File

@@ -1,17 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.16" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.16" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Datamodels\Datamodels.csproj" />
<ProjectReference Include="..\..\Repositories\Repositories.csproj" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
</Project>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0-rc.2.21480.5"/>
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0-rc.2.21480.5"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Datamodels\Datamodels.csproj"/>
<ProjectReference Include="..\..\Repositories\Repositories.csproj"/>
</ItemGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,9 @@
using System;
namespace SearchApi.Exceptions
{
public class FieldAliasMissingException : Exception
{
public FieldAliasMissingException(string message) : base(message: message) {}
}
}

View File

@@ -0,0 +1,9 @@
using System;
namespace SearchApi.Exceptions
{
public class TableAliasMissingException : Exception
{
public TableAliasMissingException(string message) : base(message: message) {}
}
}

View File

@@ -6,7 +6,7 @@ using Datamodels.BusinessModels;
using Datamodels.DatabaseModels;
using Datamodels.SearchModels;
namespace SearchLogic
namespace SearchApi.SearchLogic
{
public interface ISearchLogic
{

View File

@@ -9,14 +9,21 @@ using Datamodels.SearchModels;
using Newtonsoft.Json;
using System.Linq;
using System.Linq.Expressions;
using SearchApi.Exceptions;
namespace SearchLogic
namespace SearchApi.SearchLogic
{
public class SearchLogic : ISearchLogic
{
private readonly ILogger<SearchLogic> _logger;
private readonly IFwMariaSearchRepo _searchRepo;
private List<string> _tableNames;
private List<string> _joinConditions;
private List<string> _fieldNames;
private List<string> _whereConditions;
private List<string> _sortFields;
public SearchLogic(ILogger<SearchLogic> logger, IFwMariaSearchRepo searchRepo)
{
_logger = logger;
@@ -37,5 +44,61 @@ namespace SearchLogic
return result;
}
// Extract Table
private void GetTables(FilterModel filter)
{
bool hasTableList = filter.TableDescriptions.Count > 0;
_tableNames = new List<string>();
foreach(var table in filter.TableDescriptions)
{
if (hasTableList && string.IsNullOrEmpty(table.TableAlias))
{
throw new TableAliasMissingException($"No Alias defined for Table {table.TableName}");
}
_tableNames.Add($"{table.TableName} {(string.IsNullOrEmpty(table.TableAlias) ? string.Empty : table.TableAlias)}");
}
}
// Extract Fieldlist
private void GetFields(FilterModel filter)
{
var tables = filter.TableDescriptions;
foreach (var table in tables)
{
bool hasMultipleFields = table.Fields.Count > 0;
foreach (var field in table.Fields) {
if (hasMultipleFields && string.IsNullOrEmpty(field.FieldAlias))
{
throw new FieldAliasMissingException($"No Alias defined for Field {field.FieldName} in Table {table.TableName}");
}
_fieldNames.Add($"{table.TableAlias}.{field.FieldName} {field.FieldAlias}");
}
}
}
// Extract Join Path if more than one table
private void GetTableJoinConditions(FilterModel filter)
{
}
// Extract Where Conditions
private void GetWhereConditions(FilterModel filter)
{
}
// Extract Sort Items
private void GetSortFields(FilterModel filter)
{
}
// Assemble SQL Query
private string AssembleSqlQuery()
{
return null;
}
}
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>