Uploaded image for project: 'Entity Framework'
  1. Entity Framework
  2. EF-100

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

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

      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@mongodb.com Damien Guard
            Reporter:
            tonyhernandez743@gmail.com Anthony Hernandez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: