Skip to content

Commit

Permalink
Hide virtual attributes from solutioncomponent entity
Browse files Browse the repository at this point in the history
Fixes #524
  • Loading branch information
MarkMpn committed Aug 19, 2024
1 parent c6efe10 commit 02793eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions MarkMpn.Sql4Cds.Engine/ExecutionPlan/ExpressionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,9 @@ private static Expression ToExpression(this InPredicate inPred, ExpressionCompil
cacheKey += comparisonCacheKey;
}

if (ex != null)
throw ex;

cacheKey += ")";
sqlType = DataTypeHelpers.Bit;
return result;
Expand Down
4 changes: 3 additions & 1 deletion MarkMpn.Sql4Cds.Engine/MetadataExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ public static IEnumerable<VirtualAttribute> GetVirtualAttributes(this AttributeM

if (attrMetadata is LookupAttributeMetadata lookup)
{
if (!writeable)
// solutioncomponent entity doesn't return the names of lookup values
// https://github.com/MarkMpn/Sql4Cds/issues/524
if (!writeable && attrMetadata.EntityLogicalName != "solutioncomponent")
yield return new VirtualAttribute("name", DataTypeHelpers.NVarChar(lookup.Targets == null || lookup.Targets.Length == 0 ? 100 : lookup.Targets.Select(e => (dataSource.Metadata[e].Attributes.SingleOrDefault(a => a.LogicalName == dataSource.Metadata[e].PrimaryNameAttribute) as StringAttributeMetadata)?.MaxLength ?? 100).Max(), dataSource.DefaultCollation, CollationLabel.Implicit), null);

if (lookup.Targets?.Length != 1 && lookup.AttributeType != AttributeTypeCode.PartyList)
Expand Down

0 comments on commit 02793eb

Please sign in to comment.