Package Manager Console Commands
文章推薦指數: 80 %
The Package Manager Console is available within Visual Studio by going to Tools » Nuget ... Update-Database Updates the database to a specified migration.
Togglenavigation
LearnEntityFrameworkCore
YourguidetousingthelatestversionofMicrosoft'sObjectRelationalMapper
EFCoreNewsletter
Home
HowToGetEFCore
DbContext
AddingData
ModifyingData
DeletingData
ChangeTracker
DbSet
QueryingData
AddingData
ModifyingData
DeletingData
Model
FromExistingDatabase
ShadowProperties
Relationships
ManagingOneToManyRelationships
ReferentialConstraintActionOptions
Conventions
OneToManyRelationship
OneToOneRelationship
ManyToManyRelationship
Configuration
DataAnnotationAttributes
ColumnAttribute
ComplexTypeAttribute
ConcurrencyCheckAttribute
DatabaseGeneratedAttribute
ForeignKeyAttribute
IndexAttribute
InversePropertyAttribute
KeyAttribute
MaxLengthAttribute
NotMappedAttribute
RequiredAttribute
StringLengthAttribute
TableAttribute
TimestampAttribute
FluentApi
ModelConfiguration
PropertyConfiguration
HasAlternatekeyMethod
HasColumnNameMethod
HasColumnTypeMethod
HasComputedColumnSqlMethod
HasConstraintNameMethod
HasDataMethod
HasDefaultValueMethod
HasDefaultValueSqlMethod
HasDiscriminatorMethod
HasFieldMethod
HasForeignKeyMethod
HasIndexMethod
HasKeyMethod
HasManyMethod
HasMaxLengthMethod
HasOneMethod
HasQueryFilterMethod
HasValueMethod
Has/WithPattern
IgnoreMethod
IsConcurrencyTokenMethod
IsRequiredMethod
IsRowVersionMethod
OnDeleteMethod
ToTableMethod
ToViewMethod
TypeConfiguration
ValueGeneratedNeverMethod
ValueGeneratedOnAddMethod
ValueGeneratedOnAddOrUpdateMethod
WithManyMethod
WithOneMethod
OneToManyRelationshipConfiguration
OneToOneRelationshipConfiguration
ManyToManyRelationshipConfiguration
ConnectionStrings
Inheritance
TablePerHierarchy
Concurrency
Migrations
ModelSnapshot
SeedingData
Commands
CLICommands
PMCCommands
Walkthoughs
ASP.NETCoreMVCApplication
.NETCoreConsoleApplication
UsingAnExistingDatabase
RawSQL
DatabaseFirstAndEntityFrameworkCore
QueryTypes
LazyLoading
FastestEntityFrameworkExtensions
BulkInsert
BulkDelete
BulkUpdate
BulkMerge
PackageManagerConsoleCommands
ThePackageManagerConsoleisavailablewithinVisualStudiobygoingtoTools»NugetPackageManager.
IfyouwanttousethePackageManagerConsoletoexecutemigrationscommand,youneedtoensurethatthelatestversionofMicrosoft.EntityFrameworkCore.Toolsisaddedtoyourproject.jsonfile.
ThecommandsthatyouexecutetomanagemigrationsfromthePackageManagerConsolearelargelythesameasthoseforEntityFramework6.Thefullrangeofcommandscanbefoundbytypingget-helpentityframeworkatthePMprompt:
PM>get-helpentityframework
_/\__
---==/\\
______|.\|\
|__||__||)\\\
|_||_|\_/|//|\\
|___||_|/\\\/\\
TOPIC
about_EntityFramework
SHORTDESCRIPTION
ProvidesinformationaboutEntityFrameworkcommands.
LONGDESCRIPTION
ThistopicdescribestheEntityFrameworkcommands.EntityFrameworkisMicrosoft'srecommendeddataaccesstechnologyfornew
applications.
ThefollowingEntityFrameworkcmdletsareincluded.
CmdletDescription
-----------------------------------------------------------------------------
Add-Migration Addsanewmigration.
Remove-Migration Removesthelastmigration.
Scaffold-DbContext ScaffoldsaDbContextandentitytypeclassesforaspecifieddatabase.
Script-Migration GeneratesaSQLscriptfrommigrations.
Update-Database Updatesthedatabasetoaspecifiedmigration.
Use-DbContextSetsthedefaultDbContexttouse.
SEEALSO
Add-Migration
Remove-Migration
Scaffold-DbContext
Script-Migration
Update-Database
Use-DbContext
Youcangetfurtherhelpforspecificcommandsbytypingget-helpfollowedbythecommandname.Forexample,thefollowingoutputisgeneratedasaresultoftypingget-helpadd-migration:
Add-migration
NAME
Add-Migration
SYNOPSIS
Addsanewmigration.
SYNTAX
Add-Migration[-Name]
延伸文章資訊
- 1Update Database From Model Wizard - Overview
This article is relevant to entity models that utilize the deprecated Visual Studio integration o...
- 2EF Core 工具參考(套件管理員主控台) - Microsoft Learn
Entity Framework Core Visual Studio 套件管理員主控台的參考指南. ... Script-DbContext; Script-Migration; Update...
- 3EF Core tools reference (Package Manager Console)
Reference guide for the Entity Framework Core Visual Studio Package Manager ... Script-Migration;...
- 4Package Manager Console Commands
The Package Manager Console is available within Visual Studio by going to Tools » Nuget ... Updat...
- 5update the database from package manager console in code ...
I'm trying to update the database from package Manager console.If my Domain class change, I have ...