I know this has been asked too many times, but I could not understand the solution to the questions asked.
I am new to Entity Framework and I have developed a small CMS panel for my sites using Entity Framework 6 and Code First. My problem is that in the first stage the site is slow (this is the website that I am currently testing www.oakwoodpawnshop.ca), the download takes more than 30 seconds. After the first load, it takes about a second to load other pages. I get 89/100 from PageSpeed โโprofiles, all my images / js / css files are minimized and some other interface optimizations are being performed, so I know that my problem is with EF. I have another site that I built about 3 years ago, only using LINQ, not database optimization or html / image optimization, and it opens after about 3 seconds.
I have pre-generated views using Entity Framework Power Tools, and I have no Include methods in my codes. I filtered my requests to the .toList () function. I probably have a problem with my codes or database optimization, but I can not find a solution in the course of my research, because this area is new to me.
I found an article in my own language and asked someone with the same problem to run some codes on the command line to find out if the problem is related to network settings.
These are the lines for the command line:
1 - netsh int ip reset a.txt
2 - netsh winsock reset
3 - netsh winhttp reset proxy
4 - netsh advfirewall reset
5 - ipconfig / flushdns
6 - Restart your computer and check it again.
When I did this and registered on the website, the entire website opened in 3 seconds. After a while, he again had 30 + seconds. Obviously, I cannot run these commands on all computers, but I got lost and I have no idea why it takes so long to start.
Here is an example of the method I'm using:
public List<Categories> GetCategories() { List<Categories> c = db.Categories.Where(x => x.TopCategoryId == 0).OrderBy(x => x.CatOrder).ToList(); return c; }
I created my own methods for extracting my data (so I can use it more easily) under the "Work" class to collect all my methods in one class. Could this be a problem?
I would be happy to provide you with more information, and I have been communicating with this for about a month without any luck, so I am hopelessly looking for an answer, or I will have to recreate the entire application without EF, since the client will not wait for the website with an opening time of +30 seconds.
Thanks for all your tips!