Skip to content

Commit

Permalink
Mark IExternalDataSource as mutable if applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
anderson-joyle committed Mar 7, 2024
1 parent 7287db1 commit 74e2b41
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/libraries/Microsoft.PowerFx.Core/Binding/Binder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2873,16 +2873,9 @@ public override void Visit(FirstNameNode node)
isConstantNamedFormula = formula.IsConstant;
}
}
else if (lookupInfo.Kind == BindKind.Data)
else if (lookupInfo.Data is IExternalDataSource ds)
{
if (lookupInfo.Data is IExternalCdsDataSource or IExternalTabularDataSource)
{
_txb.SetMutable(node, true);
}
}
else if (lookupInfo.Kind == BindKind.ScopeCollection)
{
_txb.SetMutable(node, true);
_txb.SetMutable(node, ds.IsWritable);
}

Contracts.Assert(lookupInfo.Kind != BindKind.LambdaField);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ internal interface IExternalDataSource : IExternalEntity, IExternalPageableSymbo
bool IsRefreshable { get; }

bool RequiresAsync { get; }

bool IsWritable { get; }

IExternalDataEntityMetadataProvider DataEntityMetadataProvider { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class AccountsEntity : IExternalEntity, IExternalDataSource

public bool IsPageable => true;

public bool IsWritable => true;

DType IExternalEntity.Type => AccountsTypeHelper.GetDType();

IExternalDataEntityMetadataProvider IExternalDataSource.DataEntityMetadataProvider => throw new NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ internal TestDataSource(string name, DType schema, string[] keyColumns = null, I

IDelegationMetadata IExternalDataSource.DelegationMetadata => DelegationMetadata;

public bool IsWritable => throw new NotImplementedException();

public bool CanIncludeExpand(IExpandInfo expandToAdd)
{
throw new NotImplementedException();
Expand Down

0 comments on commit 74e2b41

Please sign in to comment.