title: Changes not saved to database when updating the M expression for an SSAS tabular model with .NET
body: <p>Scenario:
  we have a table with partition and we have to update the partition query using .NET</p>
  
  <p>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?</p>
  
  <pre><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&lt;OverrideCollection&gt;();
  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];
  </code></pre>