I have a SQL Server CE database configured with Entity Framework code-first with a model class InfoLog
as follows:
public class InfoLog
{
[Key]
public int Id { get; set; }
public string Item { get; set; }
}
And I save list of logs to this table using,
conn.InfoLog.AddRange(items.Select(x => new InfoLog { Item = JsonConvert.SerializeObject(x) }));
And after certain time I sync those logs with server and flush it from database using,
conObj.InfoLog.RemoveRange(itemsToFlush);
Now usually (For months for hundreds of users) it works perfectly fine, but all of sudden I start getting following error (for some random user),
System.Data.Entity.Validation.DbEntityValidationException: Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
at System.Data.Entity.Internal.InternalContext.SaveChanges()
at DataService.SaveInfoLog(List`1 items)
It clearly state to check EntityValidationErrors
, but I am unable to replicate that, even with the same SQL Server CE database on which the issue is occurring.
Now with model specified above what kind of EntityValidationError
could occur is really tough question for me.
And I am impatient to wait for next time it occurs, can anyone suggest how can I proceed to solve this.
Update:
- If we debug with same database, then records get saved.
- And on end user machine if we restart application then also records get saved.