SqlMetal命令帮助

来源:互联网 发布:jdk 7u67 windows x32 编辑:程序博客网 时间:2024/05/18 02:08

SqlMetal [options] [<input file>]

  Generates code and mapping for the LINQ to SQL component of the .NET framework. SqlMetal can:
  - Generate source code and mapping attributes or a mapping file from a database.
  - Generate an intermediate dbml file for customization from the database.
  - Generate code and mapping attributes or mapping file from a dbml file.


Options:
  /server:<name>             Database server name.
  /database:<name>           Database catalog on server.
  /user:<name>               Login user ID (default: use Windows Authentication).
  /password:<password>       Login password (default: use Windows Authentication).
  /conn:<connection string>  Database connection string. Cannot be used with /server, /database, /user or /password options.
  /timeout:<seconds>         Timeout value to use when SqlMetal accesses the database (default: 0 which means infinite).

  /views                     Extract database views.
  /functions                 Extract database functions.
  /sprocs                    Extract stored procedures.

  /dbml[:file]               Output as dbml. Cannot be used with /map option.
  /code[:file]               Output as source code. Cannot be used with /dbml option.
  /map[:file]                Generate mapping file, not attributes. Cannot be used with /dbml option.

  /language:<language>       Language for source code: VB or C# (default: derived from extension on code file name).
  /namespace:<name>          Namespace of generated code (default: no namespace).
  /context:<type>            Name of data context class (default: derived from database name).
  /entitybase:<type>         Base class of entity classes in the generated code (default: entities have no base class).
  /pluralize                 Automatically pluralize or singularize class and member names using English language rules.
  /serialization:<option>    Generate serializable classes: None or Unidirectional (default: None).
  /provider:<type>           Provider type: SQLCompact, SQL2000, SQL2005, or SQL2008. (default: provider is determined at run time).

  <input file>               May be a SqlExpress mdf file, a SqlCE sdf file, or a dbml intermediate file.

Create code from SqlServer:
  SqlMetal /server:myserver /database:northwind /code:nwind.cs /namespace:nwind

Generate intermediate dbml file from SqlServer:
  SqlMetal /server:myserver /database:northwind /dbml:northwind.dbml /namespace:nwind

Generate code with external mapping from dbml:
  SqlMetal /code:nwind.cs /map:nwind.map northwind.dbml

Generate dbml from a SqlCE sdf file:
  SqlMetal /dbml:northwind.dbml northwind.sdf

Generate dbml from SqlExpress local server:
  SqlMetal /server:./sqlexpress /database:northwind /dbml:northwind.dbml

Generate dbml by using a connection string in the command line:
  SqlMetal /conn:"server='myserver'; database='northwind'" /dbml:northwind.dbml


SqlMetal [可选的选项][输入文件名称]

 为.NET framework 的LINQ to SQL组件生成代码和映射。SqlMetal能够:
 - 由数据库生成源代码和映射属性或者映射文件。
 - 由数据库生成一个用于个性化(自定义)中介dbml文件。
 - 由dbml文件生成源代码和映射属性或者映射文件。

 选项:
 /server:<name>   数据库服务器名称[可以是包括端口号在内的IP地址等]。
 /database:<name>  数据库名称。
 /user:<name>   登录数据库服务器用户名(默认情况下使用Windows认证方式)。
 /password:<password> 登录数据库服务器密码(默认情况下使用Windows认证方式)。
 /conn:<connection string> 数据库连接字符串。不能和/server, /database, /user, /password 选项一直使用。
 /timeout:<second>  访问数据库的超时时间。(默认情况下为0,表示无穷大)


  /views    解析出数据库视图。
  /functions    解析出数据库函数[自定义函数?]。
  /sprocs    解析出存储过程。

  /dbml[:file]   以dbml方式输出。不能和/map 选项一起使用。
  /code[:file]   以源代码方式输出。不能和/dbml选项一起使用。
  /map[:file]   生成映射文件,而不是属性。不能和/dbml选项一起使用。

  /language:<language> 源代码语言:VB 或者 C#(默认情况下由指定的源代码文件名称后缀得到)。
  /namespace:<name>  生成代码的命名空间(默认情况下没有命名空间)。
  /context:<type>  Date Context 类的名称(默认情况下等于数据库名称)。
  /entitybase:<type>  生成代码中所有实体类(Entity Classes)的基类(默认情况下没有基类)。
  /pluralize    使用英文语法规则自动的添加复数或者单数的类和成员名称。
  /serialization:<option> 生成可序列化类:None 或者 Unidirectional(默认情况下为None)。
  /provider:<type>  提供者类型:SQLCompact,SQL2000,SQL2005,SQL2008(默认的提供者表示在运行时决定提供者类型)。

  <input file>   可以是一个SQL Express MDF文件或者一个SQLCE SDF文件 或者一个 dbml中介文件。

原创粉丝点击