Subsonic command line parameters and Examples

Source: Internet
Author: User
Tags connectionstrings

The following are subsonic command line parameters:

Sonic.exe v2.0.1.0-command line interface to subsonic v2.0.1.0
Usage: sonic Command [Options]
Sample: sonic generate/Server localhost/DB northwind/out generatedfiles
Help: sonic help
Tip: subsonic will read your app. config or web. config-just select the project and run your command.

******************** commands **************** *****************
Version: scripts out the schema/data of your dB to file
scriptdata: scripts the data to file for your database
scriptschema: scripts your database schema to file
Generate: generates output code for tables, views, and SPS
generatetables: generates output code for your tables
generateods: generates and objectdatasource controller for each table
generateviews: generates output code for your views
generatesps: generates output code for your SPS
Editor: creates an editor for a participant table

********************* argument list *************** * ************
####### required for all commands (these can be read from config files)
if you don't have a web or app. config, these need to be set
/override Subcommander won't try to find a config-instead it will use what you pass in
/Server-the database server-always required
/DB-the database to use

####### other commands (some may be required for specific commands)
/userid-the user ID for your database (blank = use sspi)
/password-the password for your dB (blank = use sspi)
/out-the output directory for generated items. (default = Current)
/lang-generated code language: CS or VB (default = cs)
/provider-the name of the provider to use
/includetablelist-used for generating classes. A comma-delimited list that defines which tables shoshould be used to generate classes
/config-the path your app/web. config-used to instance subsonic
/excludetablelist the opposite of tablelist. these tables will not be used to generate classes

* ******* Arguments matching subsonic web. config settings ********
Just add A'/'in front
/Generatednamespace-The namespace to use for generated code
/Templatedirectory-the directory containing template overrides
/Fixpluralclassnames-reset all plural table names to singular? True/false
/Usesps-whether to generate SP wrapper (true/false)
/Spclassname-default is 'storedprocedures '-this will override that
/Striptabletext-Replace Table text with this command
/Stripcolumntext-replace column text with this command
/Stripparamtext-replace SP Param text with this command
/Appendwith-when you have reserved words in your table columns we need to append it with something. Our default is 'x'. You can change that here.
/Spstartswith-use SPS that start with this
/Viewstartswith-use views that start with this
/Relatedtableloadprefix-Prefix related table Loaders
/Removeunderscores-whether to remove underscores from generated object names (true/false) default is false
/Templatedirectory the path to your custom templates. This is a directory reference
/Regexmatchexpression
/Regexreplaceexpression
/Regexignorecase
/Regexdictionaryreplace
/Generatelazyloads
/Generaterelatedtablesasproperties
/Extractclassnamefromspname
/Includeprocedurelist
/Excludeprocedurelist

 

**************************************** ***********************

The following is an example:

Cd c: \ Program Files \ subsonic 2.0.1

Sonic generate/ServerLocalhost/DBSubsonicdemo/OutC: \ subsonicdemo/Config"C: \ Program Files \ subsonic 2.0.1 \ sonic.exe. config"

Sonic scriptschema/ServerLocalhost/DBSubsonicdemo/OutC: \ subsonicdemo/Config"C: \ Program Files \ subsonic 2.0.1 \ sonic.exe. config"

This command will generate a series of model and controller classes. The subsequent command is to generate the schema of the specified database subsonicdemo.

Download the generated file and sample project

I have a question: does it seem that there is no command to generate page files? Can it be generated only using subsoniccentral? Let me know

**************************************** ***********************

The following is the downloaded sonic.exe. config file:

<? XML version = " 1.0 " Encoding = " UTF-8 "   ?>
< Configuration >
< Configsections >
< Section name = " Dataconfiguration "
Type = " Microsoft. Practices. enterpriselibrary. Data. configuration. databasesettings,
Microsoft. Practices. enterpriselibrary. Data, version = 2.0.0.0, culture = neutral, publickeytoken = NULL "
Requirepermission = " False " />
< Section name = " Subsonicservice "
Type = " Subsonic. subsonicsection, subsonic "
Allowdefinition = " Machinetoapplication "
Restartonexternalchanges = " True "
Requirepermission = " False " />
</ Configsections >
< Appsettings />
< Connectionstrings >
< Add name = " Subsonicdemo "
Connectionstring = " Data Source = localhost; database = subsonicdemo; Integrated Security = true; " />

</ Connectionstrings >
< Dataconfiguration defaultdatabase = " Subsonicdemoconnection " />
< Subsonicservice defaultprovider = " Subsonicdemo "   >
< Providers >
< Clear />
< Add name = " Subsonicdemo " Type = " Subsonic. sqldataprovider, subsonic "
Connectionstringname = " Subsonicdemo " Generatednamespace
= " Subsonicdemo "   />
</ Providers >
</ Subsonicservice >
</ Configuration >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.