SaveChanges() and SaveChangesAsync() always return 0 records even when successful

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • 8.0.0
    • Affects Version/s: Public Preview 1
    • None
    • None
    • Dotnet Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      In the below code, records is always 0 even though the data are written out to the database successfully.

      {{
      public async Task<IEnumerable<Guid>> SaveTestData(IEnumerable<TestData> data)

      {   _dbContext.TestData.AddRange(data);   var records = await _dbContext.SaveChangesAsync();   if (records > 0)     return data.Select(x => x.Id);   return Array.Empty<Guid>(); }

      }}

      Same is true for the sync SaveChanges() method. This makes basic logic for checking for success/failure impossible so this should be considered high priority.

              Assignee:
              Damien Guard
              Reporter:
              Anthony Hernandez
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: