diff --git a/src/libraries/Microsoft.PowerFx.Core/Binding/Binder.cs b/src/libraries/Microsoft.PowerFx.Core/Binding/Binder.cs index d989c66859..47f5a247a0 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Binding/Binder.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Binding/Binder.cs @@ -2879,6 +2879,10 @@ public override void Visit(FirstNameNode node) { _txb.SetMutable(node, true); } + else if (lookupInfo.Data is IExternalDataSource ds) + { + _txb.SetMutable(node, ds.IsWritable); + } } else if (lookupInfo.Kind == BindKind.ScopeCollection) { diff --git a/src/libraries/Microsoft.PowerFx.Core/Entities/External/IExternalDataSource.cs b/src/libraries/Microsoft.PowerFx.Core/Entities/External/IExternalDataSource.cs index ed7791bb8a..fac6d91cac 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Entities/External/IExternalDataSource.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Entities/External/IExternalDataSource.cs @@ -18,6 +18,8 @@ internal interface IExternalDataSource : IExternalEntity, IExternalPageableSymbo bool IsRefreshable { get; } bool RequiresAsync { get; } + + bool IsWritable { get; } IExternalDataEntityMetadataProvider DataEntityMetadataProvider { get; } diff --git a/src/tests/Microsoft.PowerFx.Core.Tests/AssociatedDataSourcesTests/TestDVEntity.cs b/src/tests/Microsoft.PowerFx.Core.Tests/AssociatedDataSourcesTests/TestDVEntity.cs index 256d5b0eac..55e69e1694 100644 --- a/src/tests/Microsoft.PowerFx.Core.Tests/AssociatedDataSourcesTests/TestDVEntity.cs +++ b/src/tests/Microsoft.PowerFx.Core.Tests/AssociatedDataSourcesTests/TestDVEntity.cs @@ -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(); diff --git a/src/tests/Microsoft.PowerFx.Core.Tests/Helpers/TestTabularDataSource.cs b/src/tests/Microsoft.PowerFx.Core.Tests/Helpers/TestTabularDataSource.cs index c3a78e0a19..37e39381f2 100644 --- a/src/tests/Microsoft.PowerFx.Core.Tests/Helpers/TestTabularDataSource.cs +++ b/src/tests/Microsoft.PowerFx.Core.Tests/Helpers/TestTabularDataSource.cs @@ -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();