Dotnet CLI usage

From Logic Wiki
Jump to: navigation, search


dotnet add package MicrodoftEntityFrameworkCore.SqlServer
dotnet add package MicrodoftEntityFrameworkCore.Design
dotnet restore

in order to use PM EF tools csproj file add this

<ItemGroup>
  <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0"/>
</ItemGroup>
// COPY THE PART ABOVE. PASTE AND EDIT LIKE BELOW
<ItemGroup>
  <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.1.0"/>
</ItemGroup>


to add a migration

dotnet ef migrations add InitialPackage

removes last migration

dotnet ef migrations remove

to update database

dotnet ef database update

to downgrade give migration name or number

dotnet ef database update 0