Implement missing GetColumnCapability in CdpDelegationInfo (#2698)

This commit is contained in:
Luc Genetier 2024-10-16 14:21:47 +02:00 коммит произвёл GitHub
Родитель 388d16a8ab
Коммит 6c9855ebd2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
using System;
namespace Microsoft.PowerFx.Core.Entities
{
// Used by ServiceCapabilities.ToDelegationInfo for managing CDP x-ms-capabilities
@ -8,8 +10,16 @@ namespace Microsoft.PowerFx.Core.Entities
{
public override ColumnCapabilitiesDefinition GetColumnCapability(string fieldName)
{
// We should never reach that point in CDP case
throw new System.NotImplementedException();
if (ColumnsCapabilities.TryGetValue(fieldName, out ColumnCapabilitiesBase columnCapabilitiesBase))
{
return columnCapabilitiesBase switch
{
ColumnCapabilities columnCapabilities => columnCapabilities.Definition,
_ => throw new NotImplementedException($"{columnCapabilitiesBase.GetType().Name} not supported yet")
};
}
return null;
}
}
}

Просмотреть файл

@ -34,7 +34,7 @@ namespace Microsoft.PowerFx.Core.Entities
internal PagingCapabilities PagingCapabilities { get; init; }
// Defining per column capabilities
internal IReadOnlyCollection<KeyValuePair<string, ColumnCapabilitiesBase>> ColumnsCapabilities { get; init; }
internal IReadOnlyDictionary<string, ColumnCapabilitiesBase> ColumnsCapabilities { get; init; }
// Supports per record permission
internal bool SupportsRecordPermission { get; init; }
@ -94,6 +94,8 @@ namespace Microsoft.PowerFx.Core.Entities
private ColumnCapabilitiesDefinition _capabilities;
public ColumnCapabilitiesDefinition Definition => _capabilities;
// Those are default CDS filter supported functions
// From // PowerApps-Client\src\Language\PowerFx.Dataverse.Parser\Importers\DataDescription\CdsCapabilities.cs
public static readonly IEnumerable<DelegationOperator> DefaultFilterFunctionSupport = new DelegationOperator[]