Fix. Very important. Speed improvement.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 years ago
Very important. Speed improvement.
all version.

for 60 products speed improvement 4-6 times (select data from database by store procedure)
for 150 products speed improvement more then 10 times (select data from database by store procedure)
if you are a developer read this link
http://blog.oneunicorn.com/2012/03/12/secrets-of-detectchanges-part-3-switching-off-automatic-detectchanges/

for original users
Locate NopObjectContext class
change method ExecuteStoredProcedureList
locate line
old line (in 2 place)
                    for (int i = 0; i < result.Count; i++)
                        result[i] = AttachEntityToContext(result[i]);

replace this lines (in 2 place)
                bool acd = this.Configuration.AutoDetectChangesEnabled;
                try
                {
                    this.Configuration.AutoDetectChangesEnabled = false;
                    for (int i = 0; i < result.Count; i++)
                        result[i] = AttachEntityToContext(result[i]);
                }
                finally
                {
                    this.Configuration.AutoDetectChangesEnabled = acd;
                }


or you can load our plugin MSSQLProvider for 2.8/3.0/3.1.
http://foxnetsoft.com/p/1360/nopcommerce-mssqlprovider
http://www.foxnetsoft.com/content/files/FoxNetSoft.MSSQLProvider.zip
We have intergrated it.
You can not use stored procedures (not buy), but the fix will work.
10 years ago
Thanks. I've just created a work item. In this case I just don't understand why the same is not done in the original EF assembly

P.S. Moved to "Suggestions" from "Bug reports"
10 years ago
Programming newbie here. Can you tell me where to find that file? Thanks.
10 years ago
\Libraries\Nop.Data\NopObjectContext.cs

(Do you have VS 2012?)
10 years ago
Yes, I do, but I installed the simple version without the source code. I'm concerned about crashing the site if I add all the source code. Not sure how to proceed at this point.
9 years ago
That's really a great fix!!!
6 years ago
1- Do we still need this change after disabling lazy loading from NopObjectContext ctr() ?

((IObjectContextAdapter) this).ObjectContext.ContextOptions.LazyLoadingEnabled = false;


2- Nop works properly with lazy loading disabled ?

Thanks in advance.
6 years ago
houssam.hamdan wrote:
1- Do we still need this change after disabling lazy loading from NopObjectContext ctr() ?

((IObjectContextAdapter) this).ObjectContext.ContextOptions.LazyLoadingEnabled = false;


2- Nop works properly with lazy loading disabled ?

Thanks in advance.


the code that mention in above post is already applied to new version

so you don't need to apply this fix manually
6 years ago
Yes Vipul. Im aware of that. I was asking this question to receive some insights whether we still need this performance fix if lazy loading is disabled. Thus, i asked my second question. Would be glad to receive your insights about that if possible.
6 years ago
houssam.hamdan wrote:
Yes Vipul. Im aware of that. I was asking this question to receive some insights whether we still need this performance fix if lazy loading is disabled. Thus, i asked my second question. Would be glad to receive your insights about that if possible.


yes it is required as lazy loading and tracking is both different things.

when Lazy loading is enabled it fillup the navigation propertly of an entity when navigation property is called. if its disabled when loading entity it filled all navigation properly on entity load time.


and for AutoTracking is to stop tracking of Entity by EF once it loaded so it will be faster. when we have retrive the entities only for read purpose.

so i think both is independent and above fix it good for performance improvement.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.