MDrivenWiki
Log in

Evolve db with code

From MDrivenWiki
Revision as of 12:35, 6 October 2019 by Hans (talk | contribs) (Created page with "Using the MDriven Framework you can do the evolve-database operation from within VisualStudio: 623x623px You can also do these ope...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Using the MDriven Framework you can do the evolve-database operation from within VisualStudio:

2019-10-06 14h29 19.png

You can also do these operations in runtime:

PersistenceMapperAdo2 pmapp        
var systemservice = YourEcoSpace.GetTypeSystemService();        
string[] ExecutedStatements;        
string result;          
IDBEvolutor evolutor = pmapp.GetEvolutor(systemservice);          
evolutor.CalculateScript();          
evolutor.GenerateDbScript();          
evolutor.GenerateMappingScript();          
evolutor.GenerateWarnings();          
evolutor.GenerateErrors();          
evolutor.ExecuteScript();          
result = "Evolve success\r\n";          
ExecutedStatements = evolutor.GenerateExecutedStatements();        
foreach (string s in ExecutedStatements)          
  result += s + "\r\n"; 

To fill a database with schema information the first time:

PersistenceMapperAdo2 pmapp
pmapp.CreateDatabaseSchema(YourEcoSpace.GetTypeSystemService(), new DefaultCleanPsConfig(true));