In Entity Framework, this sometimes occurs when the System.data.entity
assembly is not added into the Project. But, why I didn't have this error before in other MVC project.
it occurs sometimes but frequently and I have to add it manually in Add References. What can I do?
EF API maintains the state of each entity during its lifetime. Each entity has a state based on the operation performed on it via the context class. The entity state represented by an enum System.
dll: right-click the Reference node of your project form Solution Explorer, select Add Reference, on the pop up dialog, navigate to . NET tab, choose System. Data. Entity from the Component Name listbox.
I fixed this issue as below
Namespace
using System.Data;
using System.Data.Entity;
I was working earlier in ASP.Net MVC C# application working fine for me. I fixed this issue as below
using System.Data;
I was working earlier in ASP.Net MVC C# application working fine for me
_context.Entry(_Teach).State = System.Data.EntityState.Modified;
Now, same method using in simple c#, WCF but it giving me issue then I did this in a way as below:
_context.Entry(_Teach).State = EntityState.Modified;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With