I have an SQL Server with FILESTREAM enabled and a file table populated with a number of rows. I want to be able to delete a selected row from this table using LINQ in .NET Core 3.1.
In my infrastructure layer, I have implemented the following:
public async Task<bool> DeleteReport(Guid streamId)
{
var query = _dbContext.ReportFileTable
.Remove(await _dbContext.ReportFileTable
.Where(e => e.stream_id.Equals(streamId))
.FirstOrDefaultAsync());
var saved = await _dbContext.SaveChangesAsync();
return saved == 1 ? true : false;
}
This approach works just fine for my other regular database tables, but it fails for the FileTable and returns with a timeout when executing _dbContext.SaveChangesAsync();
despite that the query itself shows that the row is marked for deletion.
Microsoft.EntityFrameworkCore.DbUpdateException
---> Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired.
I know that .NET Core support for FileStream is little to none. How do I get around this?
User contributions licensed under CC BY-SA 3.0