-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNetCore_Notes
43 lines (30 loc) · 1.27 KB
/
NetCore_Notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
VS2015 can't open SDK 1.1.1 versions of NetCore..
latest version for vs2015:
https://go.microsoft.com/fwlink/?LinkID=835014
(dotnet-dev-win-x64.1.0.0-preview2-1-003177)
Switch NetCore sdk versions on folder.
-Create Global.json on target folder.
-Add a version from the sdk's from "C:\Program Files\dotnet\sdk" on the Global.Json:
{
"sdk": { "version": "versionName" }
}
-Run CLI dotnet --version on target folder to check changes.
//Database First ModelGenerator:
Project.json:
"dependencies": {
//...
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.0.1",
"Microsoft.EntityFrameworkCore.Design": "1.0.0-preview2-final"
},
"tools": {
//...
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},
//PM Command:
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=db;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
//Generated Connection string goes in appsettings.json:
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-WebApplication2-c6e863f8-452e-4fc5-9c4e-4db4cbb3d405;Trusted_Connection=True;MultipleActiveResultSets=true"
},
https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db