Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple relationships in ConnectorType #2747

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LucGenetier
Copy link
Contributor

Allow multiple relationships in ConnectorType
Fix CompileTimeTypeWrapperRecordValue.TryGetField
Add Equals to ConnectorType

This update doesn't update CdpRecordType yet
DV and NL repos are not impacted by these changes

Fix CompileTimeTypeWrapperRecordValue.TryGetField
@LucGenetier LucGenetier requested a review from a team as a code owner November 20, 2024 10:58
@LucGenetier
Copy link
Contributor Author

✅ No public API change.

@LucGenetier
Copy link
Contributor Author

Public API changes:
❌CP0002 M:Microsoft.PowerFx.Connectors.CdpExtensions.TryGetFieldExternalTableName(Microsoft.PowerFx.Types.RecordType,System.String,System.String@,System.String@)

@@ -17,6 +17,8 @@
using Microsoft.PowerFx.Core.Utils;
using Microsoft.PowerFx.Types;
using static Microsoft.PowerFx.Connectors.Constants;

#pragma warning disable SA1000 // The keyword 'new' should be followeed by a space
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we just want to remove this at the editorconfig level?


namespace Microsoft.PowerFx.Connectors
{
public class ConnectorRelationship
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConnectorRelationship

Is this CDP specific?

If so, how do non-CDP shims (ServiceNow) leverage it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for now, yes
as discussed this is a temporary thing
I'll add [Obsolete] to it

this.DisplayName == other.DisplayName &&
this.Description == other.Description &&
this.IsRequired == other.IsRequired &&
Enumerable.SequenceEqual((IList<ConnectorType>)this.Fields ?? Array.Empty<ConnectorType>(), (IList<ConnectorType>)other.Fields ?? Array.Empty<ConnectorType>()) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(IList)this.Fields

This is recursive - how do we verify this is not a stack overflow?

using Microsoft.PowerFx.Types;

namespace Microsoft.PowerFx.Connectors
{
public static class CdpExtensions
{
public static bool TryGetFieldExternalTableName(this RecordType recordType, string fieldName, out string tableName, out string foreignKey)
public static bool TryGetFieldRelationships(this RecordType recordType, string fieldName, out IEnumerable<ConnectorRelationship> relationships)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TryGetFieldRelationships

I'll add [Obsolete]

@@ -72,5 +73,32 @@ public static ColumnCapabilities ParseColumnCapabilities(IDictionary<string, IOp
IsChoice = isChoice
});
}

public bool Equals(ColumnCapabilities other)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public bool Equals(ColumnCapabilities other)

Intrinsically, why would we ever need to compare ColumnCapabilities?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants