Reputation: 4014
I am using Visual Studio Code on OSX. I am starting to learn asp.net core and so far I'm only able to find tutorials that teach edit project.json
to add Entity Framework dependency & then run dotnet restore
command but I'm not using yeoman to generate asp.net core project. I used dotnet new -t web
to generate project which doesn't contain any project.json
. How can use Entity Framework to store data in database?
Also please suggest some latest resources for osx users. All the existing resource on MS website are for Visual Studio Windows.
Upvotes: 1
Views: 1024
Reputation: 4014
so I figured out. I have had to add like in case of Project.json
we had dependencies
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
We can write these as follow in */ProjectName.csproj
file
Say if you want to add EntityFrameworkCore than all we need to do is:
<ItemGroup>
..
..
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.0.0" />
</ItemGroup>
and then after saving the file .csproj. Run command dotnet restore
Upvotes: 1