ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

Entity Framework Core生成的存储过程在MySQL中需要进行处理及PMC中的常用命令

2019-09-30 10:50:48  阅读:329  来源: 互联网

标签:Core help get PMC DbContext Database Migration 常用命令 type


在使用Entity Framework Core生成MySQL数据库脚本,对于生成的存储过程,在执行的过程中出现错误,需要在存储过程前面添加

delimiter //

附:可以使用Visual Studio中的程序包管理器控制台执行Entity Framework Core中的迁移命令。

PMC Command Usage
Get-Help entityframework 显示有关实体框架命令的信息。
Add-migraion <migration name> 通过添加迁移快照来创建迁移。
Remove-Migration 删除最后一个迁移快照。
Update-Database 根据上一个迁移快照更新数据库架构。
Script-Migration 使用所有迁移快照生成SQL脚本。
Scaffold-DbContext 为指定的数据库生成DbContext和实体类型类。这称为逆向工程。
Get-DbContext 获取有关DbContext类型的信息。
Drop-Database 删除数据库。

命令详解:

Get-Help
PM> get-help entityframework
        
                     _/\__
               ---==/    \\
         ___  ___   |.    \|\
        | __|| __|  |  )   \\\
        | _| | _|   \_/ |  //|\\
        |___||_|       /   \\\/\\

TOPIC
    about_EntityFrameworkCore

SHORT DESCRIPTION
    Provides information about the Entity Framework Core Package Manager Console Tools.

LONG DESCRIPTION
    This topic describes the Entity Framework Core Package Manager Console Tools. 
    See https://docs.efproject.net for information on Entity Framework Core.

    The following Entity Framework Core commands are available.

        Cmdlet                      Description
        --------------------------  ---------------------------------------------------
        Add-Migration               Adds a new migration.

        Drop-Database               Drops the database.

        Get-DbContext               Gets information about a DbContext type.

        Remove-Migration            Removes the last migration.

        Scaffold-DbContext          Scaffolds a DbContext and entity types for a database.

        Script-Migration            Generates a SQL script from migrations.

        Update-Database             Updates the database to a specified migration.

SEE ALSO
    Add-Migration
    Drop-Database
    Get-DbContext
    Remove-Migration
    Scaffold-DbContext
    Script-Migration
    Update-Database
        
Add-Migration
NAME
    Add-Migration
    
SYNOPSIS
    Adds a new migration.
    
    
SYNTAX
    Add-Migration [-Name] <String> [-OutputDir <String>] [-Context <String>] [-Project <String>] 
                    [-StartupProject <String>] [<CommonParameters>]
    
    
DESCRIPTION
    Adds a new migration.

REMARKS
    To see the examples, type: "get-help Add-Migration -examples".
    For more information, type: "get-help Add-Migration -detailed".
    For technical information, type: "get-help Add-Migration -full".
    
Remove-Migration
NAME
    Remove-Migration
    
SYNOPSIS
    Removes the last migration.
    
SYNTAX
    Remove-Migration [-Force] [-Context <String>] [-Project <String>] [-StartupProject <String>] 
                        [<CommonParameters>]
    
DESCRIPTION
    Removes the last migration.

RELATED LINKS
    Add-Migration
    about_EntityFrameworkCore 

REMARKS
    To see the examples, type: "get-help Remove-Migration -examples".
    For more information, type: "get-help Remove-Migration -detailed".
    For technical information, type: "get-help Remove-Migration -full".
 
Update-Database
NAME
    Update-Database
    
SYNOPSIS
    Updates the database to a specified migration.
    
    
SYNTAX
    Update-Database [[-Migration] <String>] [-Context <String>] [-Project <String>] 
                        [-StartupProject <String>] [<CommonParameters>]
    
    
DESCRIPTION
    Updates the database to a specified migration.
    

RELATED LINKS
    Script-Migration
    about_EntityFrameworkCore 

REMARKS
    To see the examples, type: "get-help Update-Database -examples".
    For more information, type: "get-help Update-Database -detailed".
    For technical information, type: "get-help Update-Database -full".
Script-migration
NAME
    Script-Migration
    
SYNOPSIS
    Generates a SQL script from migrations.
    
    
SYNTAX
    Script-Migration [-From] <String> [-To] <String> [-Idempotent] [-Output <String>] 
                        [-Context <String>] [-Project <String>] [-StartupProject <String>] 
                        [<CommonParameters>]
    
    Script-Migration [[-From] <String>] [-Idempotent] [-Output <String>] [-Context <String>] 
                        [-Project <String>] [-StartupProject <String>] [<CommonParameters>]
    
    
DESCRIPTION
    Generates a SQL script from migrations.
    

RELATED LINKS
    Update-Database
    about_EntityFrameworkCore 

REMARKS
    To see the examples, type: "get-help Script-Migration -examples".
    For more information, type: "get-help Script-Migration -detailed".
    For technical information, type: "get-help Script-Migration -full".

scaffold-dbcontext
NAME
    Scaffold-DbContext
    
SYNOPSIS
    Scaffolds a DbContext and entity types for a database.
    
    
SYNTAX
    Scaffold-DbContext [-Connection] <String> [-Provider] <String> [-OutputDir <String>] 
                        [-Context <String>] [-Schemas <String[]>] [-Tables <String[]>] 
                        [-DataAnnotations] [-Force] [-Project <String>] [-StartupProject <String>] 
                        [<CommonParameters>]
    
    
DESCRIPTION
    Scaffolds a DbContext and entity types for a database.
    

RELATED LINKS
    about_EntityFrameworkCore 

REMARKS
    To see the examples, type: "get-help Scaffold-DbContext -examples".
    For more information, type: "get-help Scaffold-DbContext -detailed".
    For technical information, type: "get-help Scaffold-DbContext -full".

Get-DbContext
NAME
    Get-DbContext
    
SYNOPSIS
    Gets information about a DbContext type.
    
    
SYNTAX
    Get-DbContext [-Context <String>] [-Project <String>] [-StartupProject <String>] 
                    [<CommonParameters>]
    
    
DESCRIPTION
    Gets information about a DbContext type.
    

RELATED LINKS
    about_EntityFrameworkCore 

REMARKS
    To see the examples, type: "get-help Get-DbContext -examples".
    For more information, type: "get-help Get-DbContext -detailed".
    For technical information, type: "get-help Get-DbContext -full".

Drop-Database
NAME
    Drop-Database
    
SYNOPSIS
    Drops the database.
    
    
SYNTAX
    Drop-Database [-Context <String>] [-Project <String>] [-StartupProject <String>] 
                    [-WhatIf] [-Confirm] [<CommonParameters>]
    
    
DESCRIPTION
    Drops the database.
    

RELATED LINKS
    Update-Database
    about_EntityFrameworkCore 

REMARKS
    To see the examples, type: "get-help Drop-Database -examples".
    For more information, type: "get-help Drop-Database -detailed".
    For technical information, type: "get-help Drop-Database -full".

get-help命令执行结果:
在这里插入图片描述
分享一个关于Entity Framework的网站,希望对大家有帮助:
https://www.entityframeworktutorial.net/

标签:Core,help,get,PMC,DbContext,Database,Migration,常用命令,type
来源: https://www.cnblogs.com/sesametech-netcore/p/11611512.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有