Hi,
Please refer, http://stackoverflow.com/questions/5940225/fastest-way-of-inserting-in-entity-framework
In to existing, NopCommerce framework, in Nop.Data\EFRepository.cs, Changed a method as below,
/// <summary>
/// Insert entities
/// </summary>
/// <param name="entities">Entities</param>
public virtual void Insert(IEnumerable<T> entities, bool enableTrackChanges = true)
{
try
{
if (entities == null)
throw new ArgumentNullException("entities");
if(!enableTrackChanges)
{
this._context.AutoDetectChangesEnabled = false;
}
foreach (var entity in entities)
this.Entities.Add(entity);
this._context.SaveChanges();
}
catch (DbEntityValidationException dbEx)
{
throw new Exception(GetFullErrorText(dbEx), dbEx);
}
finally
{
if (!this._context.AutoDetectChangesEnabled)
this._context.AutoDetectChangesEnabled = true;
}
}
It is giving me quite good performance, but still, I m looking some fix to implement,"recreate nopObjectContext" as given StackOverflow link,
Can you please help to implement this.