zoukankan      html  css  js  c++  java
  • scaffold-dbcontext 命令的使用

    工具的scaffold-dbcontext(数据库上下文脚手架)指令来生成models和context。

    指令详细介绍:

    Scaffold-DbContext [-Connection] <String> [-Provider] <String> [-OutputDir <String>] [-Context <String>]
    [-Schemas <String>] [-Tables <String>] [-DataAnnotations] [-Force] [-Project <String>]
    [-StartupProject <String>] [-Environment <String>] [<CommonParameters>]

    PARAMETERS
    -Connection <String>
    Specifies the connection string of the database.

    -Provider <String>
    Specifies the provider to use. For example, Microsoft.EntityFrameworkCore.SqlServer.

    -OutputDir <String>
    Specifies the directory to use to output the classes. If omitted, the top-level project directory is used.

    -Context <String>
    Specifies the name of the generated DbContext class.

    -Schemas <String>
    Specifies the schemas for which to generate classes.

    -Tables <String>
    Specifies the tables for which to generate classes.

    -DataAnnotations [<SwitchParameter>]
    Use DataAnnotation attributes to configure the model where possible. If omitted, the output code will use only the fluent API.

    -Force [<SwitchParameter>]
    Force scaffolding to overwrite existing files. Otherwise, the code will only proceed if no output files would be overwritten.

    -Project <String>
    Specifies the project to use. If omitted, the default project is used.

    -StartupProject <String>
    Specifies the startup project to use. If omitted, the solution's startup project is used.

    -Environment <String>
    Specifies the environment to use. If omitted, "Development" is used.

    示例:

    Scaffold-DbContext "Server=.;Database=MvcMovie;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Force

    Integrated Security(是否集成认证 windows账户认证的意思)

  • 相关阅读:
    CSP2020 游记
    关于对拍
    联考day7
    CSP 模拟26
    动态规划
    JAVA单元测试的用法和要点(入门篇)
    乐观锁和悲观锁的区别
    并发基础篇(六):线程Thread类的start()方法和run()方法【转载】
    this和super差异
    Java中的static关键字解析
  • 原文地址:https://www.cnblogs.com/hzz521/p/9166609.html
Copyright © 2011-2022 走看看