Tuesday, May 2, 2017

Entity exception



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

                        db.SaveChanges();
                    }
                    catch (DbEntityValidationException e)
                    {
                        foreach (var eve in e.EntityValidationErrors)
                        {
                            ;
                        }

                    }





---

Could not find an Entity Framework project type to add to the Solution. Turns out I need to add a code project first. 

Project type - Class Library but not the .NET Core Class Library. Then within that project I was able to add from Data tab a new Entity Framework item. 


No comments:

Post a Comment