Tuesday, May 8, 2018

"Visual studio verifying your model is synchronized with your source files..."


Problem:
“Visual studio verifying your model is synchronized with your source files. Your database projects will be ready after 100500 operations are completed.” message during solution loading, which takes a huge time to complete.


Explanation:
At first, we see that some model and source files are synchronized. Which model and which source files?

It’s obvious that issue related to DB-projects (we have several DB projects in our solution). So, => source files are files from DB-projects.
When we open any DB-project root folder, we can find <ProjectName>.dbmdl file. Actually, it is a file with database model generated by VS. Sync between this model and sources is mentioned in the “concern” message.

Having this model, we remove DB-project dependency on a design DB (real DB on your DEV-machine) which is used for VS intellisense, validation and other useful VS-features. Also it is used as a cache to improve performance when working with DB-project.
I just can suggest, that this is done for:
1) to have more layers J;
2) to have environment-agnostic DB-projects, I mean that DB-project can be developed with a wide range of DB servers (SQL CE, localdb, SQL Server and so on) installed in your DEV machine.





Sure, it makes sense!


But have we a stub DBs on our DEV boxes? Sure!
In my case I have figured out that empty databases exist on (localdb)\ProjectsV13 server (I caught its name when VS was loading the solution) which corresponds to our DB-projects.


My suggestion was that DB’s tables/sp/functions will be restored on this server, but it seems that they are handled in-memory from .dbmdl file.

So, on every loading we have interactions Sources <-> Model and Model <-> DB which decrease our performance.

Solutions:

  1. Add solution folder to antivirus exceptions;
  2. Add folder where design DBs are located to antivirus exceptions as well (in my case “C:\Users\AndreyMusky”);
  3. Uncheck “Auto Create Statistics” and “Auto Update Statistics” options on each DB;
  4. Check “Boost SQL Server Priority” in localdb -> Properties -> Processor section;
  5. Suggest your idea for improvement based on your experience;
  6. Believe that all we do help us;

References:

The most useful resource I’ve found is the following. At least it does not break the theory above!