Entity Framework Managing entity state

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

Entities in Entity Framework can have various states that are listed by the System.Data.Entity.EntityState enumeration. These states are:

Added    
Deleted    
Detached    
Modified    
Unchanged

Entity Framework works with POCOs. That means that entities are simple classes that have no properties and methods to manage their own state. Entity state is managed by a context itself, in the ObjectStateManager.

This topic covers various ways to set entity state.



Got any Entity Framework Question?