Before saving your changes, are you making sure that all not-null properties have a value?
In my case I had to add a hidden value in the view, so the primary key would be posted back to the server.
@Html.HiddenFor(model => model.Id)
For me, the problem was Unique Index on some of the columns in my database. Violating the index was causing this error to be displayed.
But when I was searching for the solution I found there can be other reasons for this error also , like make sure key have values and are not null , check concurrence setting for the column .
- Update Database using Entity Framework having primary key on multiple Columns
- map one to one with multiple primary key columns entity framework code first
- Multiple records using Find method in Entity Framework by passing list of primary keys
- How to filter entity framework result with multiple columns using a lambda expression
- Searching for multiple strings using single database query with entity framework and LINQ
- How to select a query with multiple columns and put it into variables using Entity Framework and ASP.NET?
- entity framework update multiple records using join
- Join to return multiple columns and using group by Entity Framework
- how to update value by 1 if username already exist in database using Linq and entity framework
- How to Update multiple tables with foreign keys using LINQ expression ASP.NET MVC Entity Framework
- Distinct on Multiple Columns Entity Framework LINQ
- EF - Update multiple rows in database without using foreach loop
- Get All Except from SQL database using Entity Framework
- Deleting multiple records with Entity Framework using a single LINQ query
- How to delete multiple records in entity framework without looping using LINQ?
- Joining multiple tables using Entity Framework
- Giving Multiple List<int> type criteria by using linq in Entity Framework
- Efficiently check if record exists in database using Entity framework LINQ
- Query Xml from SQL using Entity Framework Database First
- How to get Multiple Result Set in Entity Framework using Linq with C#?
- How to force Entity Framework 4.0 to generate parameters of equivalent size to their corresponding database columns
- Entity Framework Code First using context in Controller
- Join multiple tables and single output using Entity Framework mvc5
- Does Entity Framework query the database multiple times if I use different fields of the same Linq query at different times?
- Search From database and sort using Entity Framework
- Pull data from multiple tables in one SQL query using LINQ and Entity Framework (Core)
- How do I use CURRENT_TIMESTAMP in a LINQ update statement using Entity Framework Core?
- updating data in many-to-many relationship in entity framework in code first existing database
- Entity Framework calling database SQL string functions using Linq?
- Pulling a table from a SQL Server database into a List<> in C# using Entity Framework
- Strange LINQ query error
- LINQ Normalizing data
- Check DateTime for null in linq expression
- Handle Linq queries outputs
- Find most related post in many to many relationship
- How can I return a object with the sum of all objects from a list using Linq?
- Convert Linq statement to be used in abstracted repository pattern
- LINQ string contains another string case insensitive
- Do List.Exist using Linq
- C# how to combine two expressions into a new one?
- Linq to DataTable - Cannot cast DBNull
- LINQ to transform array [x0,y0, ..., xN, yN] into enumerable [p0, ..., pN]
- LINQ dynamic orderby from querystring
- MVC ASP.Net LINQ syntax to search for any or part of string
- making a list of int from navigation property field of an Entity
- LINQ query with variable in where clause
- Filter sublist record/s along with parent list field
- How could I make this LINQ query more efficient?
- Linq Query Slowing Down Global Asax
- Recursive Linq query