Update and Create products with attributes - Paralles

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 yıl önce
Hi!
I have a problem - trying to update and upload product data with creating new specification attribues and etc.
I do in task and the problem is i have about 1000 items to upload and its quiet slow.
I wondering how can i make it faster?
For example with Parallets.Foreach.
But for now its not work. What u can suggest?
6 yıl önce
I see right now that the most slowest operation is inserting and updating products.
I use this code

_productService.updateProducts(ProductListForUpdate);

I have about 1890 enitytes in a list. How to make it faster?
6 yıl önce
So the question is how update or insert or delete it in a scope?
I tryed to make like :

var dbContext = EngineContext.Current.Resolve<IDbContext>() as DbContext;
            
            if (dbContext != null)
            {
                using (var transaction = dbContext.Database.BeginTransaction())
                {
                    try
                    {
                        dbContext.Entry(globalprodSpecArrts).State  = EntityState.Deleted;
                        //_specificationAttributeOptionRepository.Insert(importedSpecArrtOptions);
                        _productSpecificationAttributesRepository.Delete(globalprodSpecArrts);
                        _productService.UpdateProducts(importedProducts);
                        totalProducts = importedProducts.Count;
                        UnpublishedProducts(globalProducts);
                        dbContext.SaveChanges();
                        transaction.Commit();
                        return true;
                    }
                    catch
                    {
                        transaction.Rollback();
                        throw;
                    }
                }



But it told me that LIST1 is not on current context.
6 yıl önce
Oke so fixed - i use BulkInser on context.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.