• Christina

    Christina - 2007-06-27

    i cannot figure it out how i can generate the sql scripts from my ORM model.
    I select it but in the solutions explorer i do not have any files.
    In the properties window for my model, i have some properties [Machine, Model] but nothing about the ORMGenerator.


    • Brian Nalewajek

      Brian Nalewajek - 2007-06-27


      If you have a model you've created in NORMA through Visual Studio, you should be able to have the tool generate a number of files, including DDL scripts for some common RDBMS, like MS SQL Server, as well as more generic SQL and intermediate language files.

      The first thing is to verify that you are running a version of VS 2005, standard edition or better (I don't think you could have gotten this far unless you have this already).

      Another thing that's important, is to have "Show all files" selected in Solution explorer. There's an icon in the bar that toggles this on/off.

      Have the ORM file you are working with selected in the Solution Explorer window.

      Select the Properties window, and you should see the same file name there.

      Click in the empty field to the right of the ORMgenerator label there, and you should see a "..." build icon - click that.

      You'll see a popup window with options to select those files you want generated.  For instance, if you want an MS SQL Server DDL script, make sure that that is checked.  You can uncheck those you don't want.  You'll notice that a choice for Intermediate and secondary files will always show at least a minimum set of files that the tool needs to create whatever other files you want.  You can add more that the ones checked, but these will always be created.

      Click "Save changes" to start the generation process.  When that's done, refresh the list of files in Solution Explorer, and you'll see the generated files listed there.

      If you've read many of the forum posts here, you'll know that there have been, and still are issues with the DDL scripts that NORMA generates.  The issues are probably in one of two areas: 1) Things in the ORM model that are not (yet), represented in the script files. 2) Things in the script files that don't match what you expected based on the model.  In other words, you should carefully review the DDL scripts before running them.  Also note that part of a script may run, meaning that you'll need to clean things up on the RDBMS, before you run the a revised version of the script.  There should be fewer of these issues in the latest CTP, and fewer yet in the next couple.  Matt has indicated that better DDL script generation is on the top of the list for these CTPs.  Of course you can bring up any of the files generated by clicking on them in Solution Explorer (that's why you need the Show All Files set).  Certainly pass along to the team any issues you find in the generation process, or in the scripts, to the team (bug report or forum post).

      My final suggestion is that you copy the DDL scripts that are generated by NORMA, and review and edit them in a tool that works well with the RDBMS you intend to use.  I'll use the client side tools from my installation of MS SQL Server 2005 (Standard), as it gives me much better functionality than through the VS 2005 (standard), I use to run NORMA.  Your setup and options are likely different, but find an editor that works for you.  Hope it helps.  BRN..


Log in to post a comment.