Atanas,
Thanks I got it to work. I put the service in the startup.custom.cs and it works.
But then I discovered that my error log wouldn’t update because I was using the same context and couldn’t get the error table to save when I had an error on the underlying table. I solved this by changing the state of the content exit entries to stateunchanged then I could call context.savechanges().
I offer this in case it’s useful for anyone else.
But now I come to the whole point of why I needed an error log. I’m am getting intermittent exceptions when I update a table. Seems to be an issue when I take a few minutes to finish editing the form and press save. If I edit quickly there’s no issue, if I take my time exception. I can’t find anything on the web about this but it seems like a deeper issue in EF or MSSQL. It appears to happen with all my tables.
Has anyone else come across this issue? Thanks John
Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ThrowAggregateUpdateConcurrencyException(Int32 commandIndex, Int32 expectedRowsAffected, Int32 rowsAffected)
at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeResultSetWithoutPropagation(Int32 commandIndex, RelationalDataReader reader)
at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.Consume(RelationalDataReader reader)
at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable1 commandBatches, IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList
1 entries)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList1 entriesToSave) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(DbContext _, Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func
3 operation, Func3 verifySucceeded) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.DbContext.SaveChanges() at EsWlite.EcosysService.UpdateTblClient(Nullable
1 clientId, TblClient tblClient)
at CallSite.Target(Closure , CallSite , Object )
at EsWlite.Pages.AClientEditComponent.Form0Submit(TblClient args)