On your questions:
1. What happens exactly when I run the migration script detailed in the EnsureDb method?
The method does a few things depending on the scenario:
a) If the database specified in the connection string exists on the server and is empty the method generates (and at its end executes) DDL script for the tables based on the mapping of the classes in the model. This is called the model-first approach or the forward-mapping approach.
b) If the database specified in the connection string exists on the server but contains tables, the method will calculate the differences between the content of the database and the mapping of the classes, and will generate (and at its end execute) DDL script that applies the changes from the model to the database.
c) If the database specified in the connection string does not exist on the server, the method will create it and will execute the first of the scenarios described above.
If you do not want changes in the schema of the database on your side, I would suggest the following:
1. Create a database for testing purposes,
2. Specify its name in the connection string consumed by your model,
3. Execute the method using this testing database,
4. Compare the new database with the original one,
5. Adjust the model where necessary so that the script it produces matches the database.
Regarding the warning (No persistent classes found. Is the metadata information missing?) it appears when the Fluent NuGet package is installed on a project that does not have persistent classes. If you uninstall the Fluent package and install only the Core package on your projects that consume the model, the warning will disappear.
As for the error on startup, I would suggest to you the following test:
1. Open the project file of the project that holds the model and verify that the following line is available close to its end:
2. Uninstall the Fluent package from the projects that consume the model and install the Core package on them.
3. Clean-up the solution and rebuild it.
4. Run the application for a test.
If the error appears again, the following information will be appreciated:
1. Is the class for which it appears part of the model (is it a persistent class) or it is a part of the projects that consume the model?
2. Which .NET technologies do you use in your solution?
3. The steps (both configurational and runtime) that lead to the appearance of the error.
I hope you find this feasible.
Check out the latest announcement
about Telerik Data Access vNext as a powerful framework
able to solve core development problems.