Naruto Reddy

Naruto Reddy

  • NA
  • 123
  • 36.6k

Migrating EF to EF Core

Aug 23 2020 4:59 AM
Hello Experts,
 
I have been stuck while doing migrating.
 
In the part of migrating, I started with EF to EF Core. 
 
In the Repository, we have something like below, which was added by using a library called System.Data.Entity.Migrations [Implemented by inheriting class called DbSetMigrationsExtensions]
 
public virtual void AddOrUpdate(Expression> identifierExpression, T entity)
{
if (identifierExpression == null)
throw new ArgumentNullException(nameof(identifierExpression));
if (entity == null)
throw new ArgumentNullException(nameof(entity));
DbSet.AddOrUpdate(identifierExpression, entity);
SaveChanges();
}
 
The same method I have to call in my new migrating code. 
But I am not able to add the same library in EF Core. Are there any alternate ways we can do this. ?
 
Any help would be really appreciated.

Answers (1)