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 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 ...
- 2Update Database From Model Wizard - Overview
This article is relevant to entity models that utilize the deprecated Visual Studio integration o...
- 3Package Manager Console Commands
The Package Manager Console is available within Visual Studio by going to Tools » Nuget ... Updat...
- 4ASP.NET Web Deployment using Visual Studio - Microsoft Learn
Deploy the database update · Open the Publish Web wizard by right-clicking the ContosoUniversity ...
- 5PMC Commands for Migrations in EF Core
... Core can be executed using the Package Manager Console in Visual Studio. ... Update-Database,...