Skip to content

Commit

Permalink
📝 Document powershell commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate McMaster committed Jan 12, 2016
1 parent 62ea44d commit 099bf7b
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/cli/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Command Line
============

Entity Framework provides command line tooling to automate common tasks
such as code generation and database migrations.

.. toctree::
:titlesonly:

powershell
207 changes: 207 additions & 0 deletions docs/cli/powershell.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
Package Manager Console (Visual Studio)
=======================================

Commands for Powershell in Visual Studio's Package Manager Console window.

.. contents:: `In this article:`
:depth: 2
:local:


Installation
--------------

Package Manager Console commands are installed with the *EntityFramework.Commands* package.

To open the console, follow these steps.

* Open Visual Studio 2015
* :menuselection:`Tools --> Nuget Package Manager --> Package Manager Console`
* Execute ``Install-Package EntityFramework.Commands -Pre``

Commands
--------

.. note::

All commands support the common parameters: ``Verbose``, ``Debug``,
``ErrorAction``, ``ErrorVariable``, ``WarningAction``, ``WarningVariable``,
``OutBuffer``, ``PipelineVariable``, and ``OutVariable``. For more information, see
`about_CommonParameters <http://go.microsoft.com/fwlink/?LinkID=113216)>`_.


Add-Migration
~~~~~~~~~~~~~~~~~
Adds a new migration.

::


SYNTAX
Add-Migration [-Name] <String> [-OutputDir <String>] [-Context <String>] [-Project <String>] [-StartupProject <String>] [-Environment <String>] [<CommonParameters>]

PARAMETERS
-Name <String>
Specifies the name of the migration.

-OutputDir <String>
The directory (and sub-namespace) to use. If ``omitted``, "Migrations" is used.

-Context <String>
Specifies the DbContext to use. If ``omitted``, the default DbContext is used.

-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.


Remove-Migration
~~~~~~~~~~~~~~~~~
Removes the last migration.

::

SYNTAX
Remove-Migration [-Context <String>] [-Project <String>] [-StartupProject <String>] [-Environment <String>] [<CommonParameters>]

PARAMETERS
-Context <String>
Specifies the DbContext to use. If omitted, the default DbContext is used.

-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
~~~~~~~~~~~~~~~~~~
Scaffolds a DbContext and entity type classes for a specified database.

::

SYNTAX
Scaffold-DbContext [-Connection] <String> [-Provider] <String> [-OutputDirectory <String>] [-ContextClassName <String>] [-Schemas <String[]>] [-Tables <String[]>] [-DataAnnotations] [-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, EntityFramework.MicrosoftSqlServer.

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

-ContextClassName <String>

-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.


-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.

Script-Migration
~~~~~~~~~~~~~~~~~
Generates a SQL script from migrations.

::

SYNTAX
Script-Migration -From <String> -To <String> [-Idempotent] [-Context <String>] [-Project <String>] [-StartupProject <String>] [-Environment <String>] [<CommonParameters>]

Script-Migration [-From <String>] [-Idempotent] [-Context <String>] [-Project <String>] [-StartupProject <String>] [-Environment <String>] [<CommonParameters>]
PARAMETERS
-From <String>
Specifies the starting migration. If omitted, '0' (the initial database) is used.

-To <String>
Specifies the ending migration. If omitted, the last migration is used.

-Idempotent [<SwitchParameter>]
Generates an idempotent script that can used on a database at any migration.

-Context <String>
Specifies the DbContext to use. If omitted, the default DbContext is used.

-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.


Update-Database
~~~~~~~~~~~~~~~~~
Updates the database to a specified migration.

::

SYNTAX
Update-Database [[-Migration] <String>] [-Context <String>] [-Project <String>] [-StartupProject <String>] [-Environment <String>] [<CommonParameters>]

PARAMETERS
-Migration <String>
Specifies the target migration. If '0', all migrations will be reverted. If omitted, all pending migrations will be applied.

-Context <String>
Specifies the DbContext to use. If omitted, the default DbContext is used.

-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.


Use-DbContext
~~~~~~~~~~~~~~~~~
Sets the default DbContext to use.

::

SYNTAX
Use-DbContext [-Context] <String> [-Project <String>] [-StartupProject <String>] [-Environment <String>] [<CommonParameters>]

PARAMETERS
-Context <String>
Specifies the DbContext to use.

-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.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Entity Framework Documentation
getting-started/index
providers/index
modeling/index
cli/index

Contribute
----------
Expand Down

0 comments on commit 099bf7b

Please sign in to comment.