Code-first vs Model/Database-first

I think the differences are: Code first Very popular because hardcore programmers don’t like any kind of designers and defining mapping in EDMX xml is too complex. Full control over the code (no autogenerated code which is hard to modify). General expectation is that you do not bother with DB. DB is just a storage … Read more

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

To be honest I don’t know how to check the content of the validation errors. Visual Studio shows me that it’s an array with 8 objects, so 8 validation errors. Actually you should see the errors if you drill into that array in Visual studio during debug. But you can also catch the exception and … Read more

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

To be honest I don’t know how to check the content of the validation errors. Visual Studio shows me that it’s an array with 8 objects, so 8 validation errors. Actually you should see the errors if you drill into that array in Visual studio during debug. But you can also catch the exception and … Read more

ToList().ForEach in Linq

You shouldn’t use ForEach in that way. Read Lippert’s “foreach” vs “ForEach” If you want to be cruel with yourself (and the world), at least don’t create useless List Note that the result of the All expression is a bool value that we are discarding (we are using it only because it “cycles” all the elements) I’ll repeat. You shouldn’t use ForEach to change objects. … Read more