c# - Validation failed for one or more entities when I want to save changes in SQL DataBase -


i error when try save changes in database using entity framework, code :

public void ajoutdatepoint(datetime date) {     int datestamp = convert.toint32((date - new datetime(1970, 1, 1).tolocaltime()).totalseconds);      datamodel.tb_ta_result result= new datamodel.tb_ta_result();     result.ndatetime = datestamp;     result.nuseridn = 1;     result.nshiftidn = 3;      sessioncontext.dbcontext.tb_ta_result.add(result);     sessioncontext.save(); } 

thank you

this error occurs when ef validates entity (before posting database) ensure respects configured contract (max length, required value, , on).

because didn't post entity definition + ef configuration, can't tell property ef complaining about.

but can figure out quite catching exception, of type dbentityvalidationexception, , examining contents of entityvalidationerrors property on exception. specific information tell property(ies) need attention , why.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -