EvolveDB

CapableObjects Forums SupportForum EvolveDB

This topic contains 1 reply, has 2 voices, and was last updated by  Admin 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5315 Score: 0

    william
    Participant

    I think this topics had been discussed before but since I cannot find a way to search through this forum, I am posting it here.

    How do you perform EvolveDB usually? Through the VS IDE or in codes? Personally I always call EvolveDB in codes, e.g.

    
    DBEvolutionForm.EvolveDB(Instance.persistenceMapperSqlServer1,ecoSpace.TypeSystemService,true);
    

    But I do not know how to be notified whether the user cancels the operations or there is error in the model (e.g. a new not null-able string property without default DB value). I wonder if there is any better way to EvolveDB in codes?

    #5320 Score: 0

    Admin
    Keymaster

    Hi William – we are moving all forum questions to stackoverflow – tag questions with MDriven!https://stackoverflow.com/search?q=MDriven

    To your question: This is how the automated evolve of MDrivenServer does it:
    ` IDBEvolutor evolutor = pmapp.GetEvolutor(rmes);

    evolutor.CalculateScript();
    string[] scripttolog = evolutor.GenerateDbScript();
    string[] mappingtolog = evolutor.GenerateMappingScript();
    string[] warningstolog = evolutor.GenerateWarnings();
    string[] errorstolog = evolutor.GenerateErrors();
    if (errorstolog.Length > 0)
    AddServerDBLog(zv, “Errors”, errorstolog);
    if (warningstolog.Length > 0)
    AddServerDBLog(zv, “Warnings”, warningstolog);
    if (scripttolog.Length > 0)
    AddServerDBLog(zv, “Script”, scripttolog);
    // Just annoying AddServerDBLog(zv, “MappingScript”, mappingtolog);
    evolutor.ExecuteScript();

    string[] ExecutedStatements = evolutor.GenerateExecutedStatements();

    AddServerDBLog(zv, “ExecutedStatements”, ExecutedStatements);
    zv.ServerHasUpdatedDatabase();
    zv.ServerDBCreateAndEvolveLog += “Evolve success”;

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Comments are closed.