After declaring and compiling your domain (i.e.
your domain object classes), you use dbschema.exe
to derive an sql-script from it. This sql-script in
turn sets up your database for persisting instances
of the domain object classes.
The canonical way to develop a re-motion application
is to have
This is called the canonical project structure. If you have
not read the page canonical project structure yet, please
do so. The following explanation will assume the
canonical project structure.
If you have a sample project that will use the domain
object classes, you can use the application's
(App.config) for telling
dbschema.exe what the
name of the database is. If you don't specify an
dbschema.exe will generate a
USE DatabaseName –
for first experiments this is easy to fix manually, of course.
The output file, the sql script for setting up the database,
is named (SetupDB.sql). It does not matter where you store it,
but we invoke
dbschema.exe in the solution root, i.e.
the parent directory of all sub-projects. For the PhoneBook
project, this invocation looks like this:
Remotion\net-3.5\bin\debug\dbschema.exe /basedirectory:PhoneBook.domain\bin\debug /verbose /config:PhoneBook.Sample\App.config
/basedirectoryis the directory with the domain assembly (can be more than one)
/verboseswitch gives you more comprehensive error messages in the case something goes wrong
configswitch specifies which configuration file
If everything works out,
dbschema.exe has no output.
/config are optional. As explained above,
USE DatabaseName instead of
USE PhoneBook (for example),
so that you have to fix the database name manually.