I am executing a project using the Entity Framework Code-First approach. Everything went well until we changed the location of the database:
connectionString="Data Source=(LocalDB)\ProjectsV12;AttachDbFilename=|DataDirectory|\Schema.Test.mdf;Integrated Security=True;Connect Timeout=30"
And then we set DataDirectory:
AppDomain.CurrentDomain.SetData("DataDirectory", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\TestDB\\");
Now we have several databases with names SCHEMA_TEST_*, where *is a random number (I'm sure it is not random, but I did not understand how it was generated). Also, I'm not sure what causes the creation of another database, not the first. Why does he create other databases and why can't he just be called Schema.Test, as I mentioned in connectionString?
UPDATE
When I delete the AttachDbFilenameconnection string section , everything seems to return to normal no matter what I do. Although, admittedly, I'm still not sure how and why additional databases are created. Although, it seems, this is done every time a circuit change occurs. What should not happen since then, we use migration.
source
share