I faced this error before
when I tried to update specific field in my model in entity framwork
Letter letter = new Letter {ID = letterId, ExportNumber = letterExportNumber,EntityState = EntityState.Modified};
LetterService.ChangeExportNumberfor(letter);
//----------
public int ChangeExportNumber(Letter letter)
{
int result = 0;
using (var db = ((LettersGeneratorEntities) GetContext()))
{
db.Letters.Attach(letter);
db.Entry(letter).Property(x => x.ExportNumber).IsModified = true;
result += db.SaveChanges();
}
return result;
}
and according the above answers
I found the Validation message The SignerName field is required.
which pointing to field in my model
and when I checked my database schema I found
so off coure ValidationException
has its right to raise
and according to this field I want it to be nullable, (I dont know how I messed it)
so I changed that field to allow Null, and by this my code will not give me this error again
so This error maybe will happened if you invalidate Your Data integrity of your database