If you are migrating your application where Entity Framework 5.0.0 (EF 5) is used, to latest .NET framework 4.8 from 4.6 range, then after upgrading your .NET framework, you will be advised to upgrade Entity Framework as well.
Once I upgraded Entity Framework to 6.2.0 (EF 6), we have encountered with some compilation issue. like below:
Operator '==' cannot be applied to operands of type 'EntityState' and 'EntityState'
Do not worry, this is not a huge change.
Wherever you have used "System.Data.EntityState" needs to be changed to "System.Data.Entity.EntityState".
With EF 6.0 the code snippet in DbContextRepository.cs goes from:
if (entry.State == System.Data.EntityState.Detached)
{
items.Attach(item);
entry.State = System.Data.EntityState.Modified;
}
to
if (entry.State == System.Data.Entity.EntityState.Detached)
{
items.Attach(item);
entry.State = System.Data.Entity.EntityState.Modified;
}
- 85 reads