Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dotnetcli #1922

Merged
merged 8 commits into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions entity-framework/core/get-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Install the following software:

## [.NET Core CLI](#tab/netcore-cli)

``` Console
```dotnetcli
dotnet new console -o EFGetStarted
cd EFGetStarted
```
Expand All @@ -53,7 +53,7 @@ To install EF Core, you install the package for the EF Core database provider(s)

## [.NET Core CLI](#tab/netcore-cli)

``` Console
```dotnetcli
dotnet add package Microsoft.EntityFrameworkCore.Sqlite
```

Expand Down Expand Up @@ -100,7 +100,7 @@ The following steps use [migrations](xref:core/managing-schemas/migrations/index

* Run the following commands:

``` Console
```dotnetcli
dotnet tool install --global dotnet-ef
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet ef migrations add InitialCreate
Expand Down Expand Up @@ -133,7 +133,7 @@ The following steps use [migrations](xref:core/managing-schemas/migrations/index

## [.NET Core CLI](#tab/netcore-cli)

``` Console
```dotnetcli
dotnet run
```

Expand Down
4 changes: 2 additions & 2 deletions entity-framework/core/get-started/install/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ To install or update NuGet packages, you can use the .NET Core command-line inte

* Use the following .NET Core CLI command from the operating system's command line to install or update the EF Core SQL Server provider:

``` Console
```dotnetcli
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
```

Expand Down Expand Up @@ -89,7 +89,7 @@ Although you can also use the `dotnet ef` commands from the Package Manager Cons

The `dotnet ef` commands are included in current versions of the .NET Core SDK, but to enable the commands on a specific project, you have to install the `Microsoft.EntityFrameworkCore.Design` package:

``` Console
```dotnetcli
dotnet add package Microsoft.EntityFrameworkCore.Design
```

Expand Down
14 changes: 7 additions & 7 deletions entity-framework/core/managing-schemas/migrations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ After you've [defined your initial model](xref:core/modeling/index), it's time t

## [.NET Core CLI](#tab/dotnet-core-cli)

``` Console
```dotnetcli
dotnet ef migrations add InitialCreate
```

Expand Down Expand Up @@ -64,7 +64,7 @@ Next, apply the migration to the database to create the schema.

## [.NET Core CLI](#tab/dotnet-core-cli)

``` Console
```dotnetcli
dotnet ef database update
```

Expand All @@ -82,7 +82,7 @@ After making changes to your EF Core model, the database schema might be out of

## [.NET Core CLI](#tab/dotnet-core-cli)

``` Console
```dotnetcli
dotnet ef migrations add AddProductReviews
```

Expand Down Expand Up @@ -143,7 +143,7 @@ Apply the migration to the database using the appropriate command.

## [.NET Core CLI](#tab/dotnet-core-cli)

``` Console
```dotnetcli
dotnet ef database update
```

Expand Down Expand Up @@ -171,7 +171,7 @@ Sometimes you add a migration and realize you need to make additional changes to

## [.NET Core CLI](#tab/dotnet-core-cli)

``` Console
```dotnetcli
dotnet ef migrations remove
```

Expand All @@ -191,7 +191,7 @@ If you already applied a migration (or several migrations) to the database but n

## [.NET Core CLI](#tab/dotnet-core-cli)

``` Console
```dotnetcli
dotnet ef database update LastGoodMigration
```

Expand All @@ -209,7 +209,7 @@ When debugging your migrations or deploying them to a production database, it's

## [.NET Core CLI](#tab/dotnet-core-cli)

``` Console
```dotnetcli
dotnet ef migrations script
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ If you did everything correctly, you should be able to add new migrations to the

## [.NET Core CLI](#tab/dotnet-core-cli)

``` Console
```dotnetcli
dotnet ef migrations add NewMigration --project MyApp.Migrations
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ When adding new migration, specify the context types.

## [.NET Core CLI](#tab/dotnet-core-cli)

``` Console
```dotnetcli
dotnet ef migrations add InitialCreate --context MyDbContext --output-dir Migrations/SqlServerMigrations
dotnet ef migrations add InitialCreate --context MySqliteDbContext --output-dir Migrations/SqliteMigrations
```
Expand Down
8 changes: 4 additions & 4 deletions entity-framework/core/managing-schemas/scaffolding.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ How you quote and escape the connection string depends on which shell you are us
Scaffold-DbContext 'Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Chinook' Microsoft.EntityFrameworkCore.SqlServer
```

``` Console
```dotnetcli
dotnet ef dbcontext scaffold "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Chinook" Microsoft.EntityFrameworkCore.SqlServer
```

Expand All @@ -36,7 +36,7 @@ If you have an ASP.NET Core project, you can use the `Name=<connection-string>`

This works well with the [Secret Manager tool](https://docs.microsoft.com/aspnet/core/security/app-secrets#secret-manager) to keep your database password separate from your codebase.

``` Console
```dotnetcli
dotnet user-secrets set ConnectionStrings.Chinook "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Chinook"
dotnet ef dbcontext scaffold Name=Chinook Microsoft.EntityFrameworkCore.SqlServer
```
Expand All @@ -61,7 +61,7 @@ Scaffold-DbContext ... -Tables Artist, Album

To include multiple tables in the CLI, specify the option multiple times.

``` Console
```dotnetcli
dotnet ef dbcontext scaffold ... --table Artist --table Album
```

Expand Down Expand Up @@ -103,7 +103,7 @@ You can also use `-ContextDir` (PMC) and `--context-dir` (CLI) to scaffold the D
Scaffold-DbContext ... -ContextDir Data -OutputDir Models
```

``` Console
```dotnetcli
dotnet ef dbcontext scaffold ... --context-dir Data --output-dir Models
```

Expand Down
2 changes: 1 addition & 1 deletion entity-framework/core/miscellaneous/1x-2x-upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ var tableName = context.Model.FindEntityType(typeof(User)).Relational().TableNam

Instead of using methods like `ForSqlServerToTable`, extension methods are now available to write conditional code based on the current provider in use. For example:

```C#
```csharp
modelBuilder.Entity<User>().ToTable(
Database.IsSqlServer() ? "SqlServerName" : "OtherName");
```
Expand Down
20 changes: 10 additions & 10 deletions entity-framework/core/miscellaneous/cli/dotnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The installation procedure depends on project type and version:

* `dotnet ef` must be installed as a global or local tool. Most developers will install `dotnet ef` as a global tool with the following command:

``` console
```dotnetcli
dotnet tool install --global dotnet-ef
```

Expand All @@ -38,7 +38,7 @@ The installation procedure depends on project type and version:

* Install the latest `Microsoft.EntityFrameworkCore.Design` package.

``` Console
```dotnetcli
dotnet add package Microsoft.EntityFrameworkCore.Design
```

Expand All @@ -56,7 +56,7 @@ The `dotnet ef` commands are included in the .NET Core SDK, but to enable the co

* Install the latest stable `Microsoft.EntityFrameworkCore.Design` package.

``` Console
```dotnetcli
dotnet add package Microsoft.EntityFrameworkCore.Design
```

Expand All @@ -70,7 +70,7 @@ The `dotnet ef` commands are included in the .NET Core SDK, but to enable the co

* Install the latest 1.x version of the `Microsoft.EntityFrameworkCore.Design` package, for example:

```console
```dotnetcli
dotnet add package Microsoft.EntityFrameworkCore.Design -v 1.1.6
```

Expand Down Expand Up @@ -100,7 +100,7 @@ The `dotnet ef` commands are included in the .NET Core SDK, but to enable the co

Run the following commands to verify that EF Core CLI tools are correctly installed:

``` Console
```dotnetcli
dotnet restore
dotnet ef
```
Expand Down Expand Up @@ -189,7 +189,7 @@ Arguments:

The following examples update the database to a specified migration. The first uses the migration name and the second uses the migration ID:

```console
```dotnetcli
dotnet ef database update InitialCreate
dotnet ef database update 20180904195021_InitialCreate
```
Expand Down Expand Up @@ -228,13 +228,13 @@ Options:

The following example scaffolds all schemas and tables and puts the new files in the *Models* folder.

```console
```dotnetcli
dotnet ef dbcontext scaffold "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -o Models
```

The following example scaffolds only selected tables and creates the context in a separate folder with a specified name:

```console
```dotnetcli
dotnet ef dbcontext scaffold "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -o Models -t Blog -t Post --context-dir Context -c BlogContext
```

Expand Down Expand Up @@ -288,13 +288,13 @@ Options:

The following example creates a script for the InitialCreate migration:

```console
```dotnetcli
dotnet ef migrations script 0 InitialCreate
```

The following example creates a script for all migrations after the InitialCreate migration.

```console
```dotnetcli
dotnet ef migrations script 20180904195021_InitialCreate
```

Expand Down
8 changes: 4 additions & 4 deletions entity-framework/core/providers/cosmos/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ uid: core/providers/cosmos/index
---
# EF Core Azure Cosmos DB Provider

>[!NOTE]
> [!NOTE]
> This provider is new in EF Core 3.0.

This database provider allows Entity Framework Core to be used with Azure Cosmos DB. The provider is maintained as part of the [Entity Framework Core Project](https://github.com/aspnet/EntityFrameworkCore).

It is strongly recommended to familiarize yourself with the [Azure Cosmos DB documentation](/azure/cosmos-db/introduction) before reading this section.

>[!NOTE]
> [!NOTE]
> This provider only works with the SQL API of Azure Cosmos DB.

## Install
Expand All @@ -24,7 +24,7 @@ Install the [Microsoft.EntityFrameworkCore.Cosmos NuGet package](https://www.nug

## [.NET Core CLI](#tab/dotnet-core-cli)

``` console
```dotnetcli
dotnet add package Microsoft.EntityFrameworkCore.Cosmos
```

Expand Down Expand Up @@ -83,7 +83,7 @@ By default EF Core will create containers with the partition key set to `"__part

[!code-csharp[PartitionKey](../../../../samples/core/Cosmos/ModelBuilding/OrderContext.cs?name=PartitionKey)]

>[!NOTE]
> [!NOTE]
>The partition key property can be of any type as long as it is [converted to string](xref:core/modeling/value-conversions).

Once configured the partition key property should always have a non-null value. When issuing a query a condition can be added to make it single-partition.
Expand Down
2 changes: 1 addition & 1 deletion entity-framework/core/providers/in-memory/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Install the [Microsoft.EntityFrameworkCore.InMemory NuGet package](https://www.n

## [.NET Core CLI](#tab/dotnet-core-cli)

``` console
```dotnetcli
dotnet add package Microsoft.EntityFrameworkCore.InMemory
```

Expand Down
2 changes: 1 addition & 1 deletion entity-framework/core/providers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Most database providers for EF Core are distributed as NuGet packages, and can b

## [.NET Core CLI](#tab/dotnet-core-cli)

``` console
```dotnetcli
dotnet add package provider_package_name
```

Expand Down
2 changes: 1 addition & 1 deletion entity-framework/core/providers/sql-server/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Install the [Microsoft.EntityFrameworkCore.SqlServer NuGet package](https://www.

## [.NET Core CLI](#tab/dotnet-core-cli)

``` console
```dotnetcli
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
```

Expand Down
2 changes: 1 addition & 1 deletion entity-framework/core/providers/sqlite/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Install the [Microsoft.EntityFrameworkCore.Sqlite NuGet package](https://www.nug

## [.NET Core CLI](#tab/dotnet-core-cli)

``` console
```dotnetcli
dotnet add package Microsoft.EntityFrameworkCore.Sqlite
```

Expand Down
Loading