Skip to content

Commit

Permalink
IsWritable flag
Browse files Browse the repository at this point in the history
  • Loading branch information
anderson-joyle committed Mar 7, 2024
1 parent dc94d23 commit b7cb42b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/libraries/Microsoft.PowerFx.Core/Binding/Binder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2882,7 +2882,10 @@ public override void Visit(FirstNameNode node)
}
else if (lookupInfo.Kind == BindKind.ScopeCollection)
{
_txb.SetMutable(node, true);
if (lookupInfo.Data is IExternalDataSource ds)
{
_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 @@ -19,6 +19,8 @@ internal interface IExternalDataSource : IExternalEntity, IExternalPageableSymbo

bool RequiresAsync { get; }

bool IsWritable { get; }

IExternalDataEntityMetadataProvider DataEntityMetadataProvider { get; }

DataSourceKind Kind { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.PowerFx.Core.Entities;
using Microsoft.PowerFx.Core.Entities.Delegation;
using Microsoft.PowerFx.Core.Functions.Delegation;
Expand All @@ -30,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 @@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using Microsoft.PowerFx.Core.Binding.BindInfo;
using Microsoft.PowerFx.Core.Entities;
using Microsoft.PowerFx.Core.Entities.Delegation;
Expand Down Expand Up @@ -219,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 b7cb42b

Please sign in to comment.