How can I retrieve Id of inserted entity using Entity framework? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago. Improve this question I have a problem with Entity Framework in ASP.NET. I want to get the Id … Read more

There is already an open DataReader associated with this Command which must be closed first

I have this query and I get the error in this function: var accounts = from account in context.Accounts from guranteer in account.Gurantors select new AccountsReport { CreditRegistryId = account.CreditRegistryId, AccountNumber = account.AccountNo, DateOpened = account.DateOpened, }; return accounts.AsEnumerable() .Select((account, index) => new AccountsReport() { RecordNumber = FormattedRowNumber(account, index + 1), CreditRegistryId = account.CreditRegistryId, DateLastUpdated … Read more

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

This question already has answers here: Getting exact error type in from DbValidationException (7 answers) Closed 1 year ago. I am having this error when seeding my database with code first approach. Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details. To be honest I don’t know how to check the … Read more