Dotnet Bangalore training Institute : pragimtech

June 15, 2016

http://www.pragimtech.com/Home.aspx

https://www.youtube.com/user/kudvenkat/playlists

http://csharp-video-tutorials.blogspot.in/

Advertisements

Entity Framework notes : Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details

May 3, 2015

Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details

try
{
// Your code…
// Could also be before try if you know the exception occurs in SaveChanges

context.SaveChanges();
}
catch (DbEntityValidationException e)
{
foreach (var eve in e.EntityValidationErrors)
{
Console.WriteLine(“Entity of type \”{0}\” in state \”{1}\” has the following validation errors:”,
eve.Entry.Entity.GetType().Name, eve.Entry.State);
foreach (var ve in eve.ValidationErrors)
{
Console.WriteLine(“- Property: \”{0}\”, Error: \”{1}\””,
ve.PropertyName, ve.ErrorMessage);
}
}
throw;
}


.Net notes : Entity Framework

May 1, 2015

‘Unable to update the EntitySet ‘xxxxxxxx’ because it has a DefiningQuery and no element exists in the element to support the current operation.’

Please check:

1. Make sure you have ”xxxxxxx” table in your datgbase

2. Make sure you have the Primary Key in that table

3. If the the table and Primary Key are existing, please updated the Entity map and publish again.