Changes not saved to database when updating the M expression for an SSAS tabular model with .NET

廉价感情. 提交于 2019-12-11 17:57:34

问题


Scenario: we have a table with partition and we have to update the partition query using .NET

We use the code below to replace the existing M Expression with a new one, but the changes are not updating at the database level (Analysis Tabular). Are there any syntax errors or problems in this code?

TOA.Partition partition = m.Tables.Find(Table).Partitions[1];

OverrideCollection oc = new OverrideCollection
{
  Partitions =
  {
    new PartitionOverride
    {
      OriginalObject =partition,
      Source = new MPartitionSourceOverride
      {
        Expression=expressions
      }

    }

  }

};


var listOc = new List<OverrideCollection>();
listOc.Add(oc);
partition.RequestRefresh(TOA.RefreshType.Add, listOc);
// m.Tables[Table].Partitions[1].Refresh(TOA.RefreshType.Full, listOc); //it is not working 
db.Update(UpdateOptions.ExpandFull);
db.Model.SaveChanges();
m.SaveChanges();
TOA.Partition partition1 = m.Tables.Find(Table).Partitions[1];

来源:https://stackoverflow.com/questions/55156754/changes-not-saved-to-database-when-updating-the-m-expression-for-an-ssas-tabular

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!