How to create static data when creating model from scratch

Nov 15, 2010 at 4:19 PM

Hi,

nHydrate newbie here.

I am creating a model from scratch and want to insert static data into some lookup tables.  The only option I can see is to import (after right clicking on a table in the model view) but this opens a wizard to import data from an existing table.  Is there a way to add static data other than import?

I'm guessing I might need to edit one of the update sql scripts - or possibly create some tables to import data from initially just so that the rest of the database installer process flows smoothly.

Thanks

Coordinator
Nov 16, 2010 at 2:32 AM

Click on a table and in the property box look for "Static Data". There is a button to open a dialog and you can enter data there.

Nov 16, 2010 at 8:47 AM

Lol,

How did I miss that?  :-)  Thanks for the reply.

Coordinator
Nov 25, 2010 at 5:23 PM

You can also add all sorts of scripts to the installer project (not only static data). You can add SQL and ZIP (of SQL files) files under the installer project in the "Create Scripts" folder. Make the file embedded resources and they will be compiled into the assembly. They will be executed in alphabetical order. If you have really big script files then ZIP them and add the ZIP file. It will be unzipped and run based on the same rules. We have used this to include US ZIP codes, Metros, towns, etc into a compiled scripts that gets executed by the installer. You will notice that all the SQL files in the project are just embedded resources. Simply add your own scripts and embed them and they will get executed too.