You can resolve a local Save script failure in MDriven Designer by installing SQL Server Compact Edition 4.0 and restarting Visual Studio; this page is for developers saving an ECO mapping script from a model, not for MDrivenServer admin-database evolve errors.
What Save script does
Save script stores the model's current object-relational mapping (OR mapping) script in the target database. MDriven uses that stored script as the old version when it calculates a later database evolve.
For example, after you add a ReleaseDate attribute to a persistent class, MDriven compares the current mapping with the previously saved mapping to determine that an ALTER TABLE ... ADD ReleaseDate change is required.
Symptom
You try to save the ECO model script to a SQL database from Visual Studio, but the operation fails.
A common cause is that SQL Server Compact Edition 4.0 is not installed on the development machine. The dependency must be available to the Visual Studio environment that runs MDriven Designer.
Fix the local Save script failure
- Install SQL Server Compact Edition 4.0 on the machine where you run Visual Studio.
- Close Visual Studio.
- Start Visual Studio again. Restarting is required so Visual Studio loads the installed components.
- Open the model and retry Save script using the same database connection.
- Confirm that the operation completes before you rely on database evolve for later model changes.
Verify the database is ready for evolve
After a successful save, the database should retain the current OR mapping in its administrative mapping data. This saved mapping is what lets MDriven compare the current model with the earlier database state.
If you are working with a reversed existing database, saving the script may create the Eco_OrMapping table when it is absent. A reversed database may also need additional administrative tables before you can evolve broader model changes. Follow HowTos:Reverse Engineer a Database and HowTos:MDriven Administrative Database Tables for that workflow.
Do not use this fix for MDrivenServer evolve failures
This page concerns the local Visual Studio/MDriven Designer Save script operation. It does not repair a missing or empty evolve script in an MDrivenServer administrative database.
Use the symptom to choose the correct procedure:
| What you observe | What to do |
|---|---|
| Saving a script from Visual Studio fails on the development machine. | Install SQL Server Compact Edition 4.0, restart Visual Studio, and retry the save. |
| The MDrivenServer admin page returns an empty current evolve script, or an admin database evolve fails after an upgrade. | Follow Documentation:MDriven Server problem with evolve. |
You receive Unknown valuetype and the admin_ECO_ORMAPPING data has been cleared.
|
Follow Documentation:Unknown valuetype. |
| An evolve completed incorrectly and data or links in the database are inconsistent. | Follow Documentation:Database corruption and Documentation:Validate data in the database. |
