title: EF6 Not saving changes to Database
body: <p>After following this tutorial: <a href="https://www.codeproject.com/Articles/5251396/Use-Azure-Functions-to-process-a-CSV-File-and-impo" rel="nofollow noreferrer">https://www.codeproject.com/Articles/5251396/Use-Azure-Functions-to-process-a-CSV-File-and-impo</a></p>
  <p>I have run into an issue. My code executes perfectly, but the data is not saved to the db. I have tried my UAT database on azure as well as my local instance.</p>
  <p>Here is the code I have:</p>
  <pre><code>
  namespace func
  {
      public class Function3
      {
          [FunctionName(&quot;storagetrigger&quot;)]
          public async Task Run([BlobTrigger(&quot;filedump/{name}&quot;, Connection = &quot;StorageConn&quot;)] Stream myBlob, string name, ILogger log)
          {
              log.LogInformation($&quot;C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes&quot;);
              if (myBlob.Length &gt; 0)
              {
                  using (var reader = new StreamReader(myBlob))
                  {
                      var lineNumber = 1;
                      var line = await reader.ReadLineAsync();
                      while (line != null)
                      {
                          await ProcessLine(name, line, lineNumber, log);
                          line = await reader.ReadLineAsync();
                          lineNumber++;
                      }
                  }
              }
          }
  
          private static async Task ProcessLine(string name, string line, int lineNumber, ILogger log)
          {
              if (string.IsNullOrWhiteSpace(line))
              {
                  log.LogWarning($&quot;{name}: {lineNumber} is empty.&quot;);
                  return;
              }
  
              var parts = line.Split('|');
              if (parts.Length != 14)
              {
                  log.LogError($&quot;{name}: {lineNumber} invalid data: {line}.&quot;);
                  return;
              }
  
              PackDataModel(parts ,out var item); //Packs data into my model
  
              using (var context = new PartContext())
              {
                  context.Parts.Add(item);
                  await context.SaveChangesAsync();
                  log.LogInformation($&quot;{name}: {lineNumber} inserted task: \&quot;{item.PartDescription}\&quot; with id: {item.PartNumber}.&quot;);
              }
          }
      }
  }
  
  </code></pre>
  <p>My DB context:</p>
  <pre><code>    internal class PartContext : DbContext
      {
          public PartContext() : base(&quot;PartsContext&quot;)
          {
          }
  
          public DbSet&lt;Part&gt; Parts { get; set; }
      }
  </code></pre>
  <p>The local conn string I used:</p>
  <pre><code>&quot;PartsContext&quot;: &quot;Provider=MySQL Provider;server=localhost;User Id=MyID;password=myPassword;database=mydb;&quot;
  </code></pre>
  <p>Another conn string I tried:</p>
  <pre><code>&quot;PartsContext&quot;: &quot;Server=.;Database=sqldb-filedump-mpw-uat;Trusted_Connection=True;&quot;
  </code></pre>