├── .gitattributes
├── .gitignore
├── .vs
├── BlogPlayground
│ └── v14
│ │ └── .suo
├── config
│ └── applicationhost.config
└── restore.dg
├── BlogPlayground.sln
├── global.json
└── src
└── BlogPlayground
├── .bowerrc
├── BlogPlayground.xproj
├── BlogPlayground.xproj.user
├── Controllers
├── AccountController.cs
├── ArticlesController.cs
├── HomeController.cs
└── ManageController.cs
├── Data
├── ApplicationDbContext.cs
└── Migrations
│ ├── 00000000000000_CreateIdentitySchema.Designer.cs
│ ├── 00000000000000_CreateIdentitySchema.cs
│ ├── 20160910210414_update-profile.Designer.cs
│ ├── 20160910210414_update-profile.cs
│ ├── 20160913175647_articles.Designer.cs
│ ├── 20160913175647_articles.cs
│ └── ApplicationDbContextModelSnapshot.cs
├── Models
├── AccountViewModels
│ ├── ExternalLoginConfirmationViewModel.cs
│ ├── ForgotPasswordViewModel.cs
│ ├── LoginViewModel.cs
│ ├── RegisterViewModel.cs
│ ├── ResetPasswordViewModel.cs
│ ├── SendCodeViewModel.cs
│ └── VerifyCodeViewModel.cs
├── ApplicationUser.cs
├── Article.cs
└── ManageViewModels
│ ├── AddPhoneNumberViewModel.cs
│ ├── ChangePasswordViewModel.cs
│ ├── ConfigureTwoFactorViewModel.cs
│ ├── FactorViewModel.cs
│ ├── IndexViewModel.cs
│ ├── ManageLoginsViewModel.cs
│ ├── RemoveLoginViewModel.cs
│ ├── SetPasswordViewModel.cs
│ └── VerifyPhoneNumberViewModel.cs
├── Program.cs
├── Project_Readme.html
├── Properties
└── launchSettings.json
├── Services
├── GooglePictureLocator.cs
├── IEmailSender.cs
├── IGooglePictureLocator.cs
├── ISmsSender.cs
└── MessageServices.cs
├── Startup.cs
├── TagHelpers
├── MarkdownTagHelper.cs
└── ProfilePictureTagHelper.cs
├── ViewComponents
└── LatestArticlesViewComponent.cs
├── Views
├── Account
│ ├── ConfirmEmail.cshtml
│ ├── ExternalLoginConfirmation.cshtml
│ ├── ExternalLoginFailure.cshtml
│ ├── ForgotPassword.cshtml
│ ├── ForgotPasswordConfirmation.cshtml
│ ├── Lockout.cshtml
│ ├── Login.cshtml
│ ├── Register.cshtml
│ ├── ResetPassword.cshtml
│ ├── ResetPasswordConfirmation.cshtml
│ ├── SendCode.cshtml
│ └── VerifyCode.cshtml
├── Articles
│ ├── Create.cshtml
│ ├── Delete.cshtml
│ ├── Details.cshtml
│ ├── Index.cshtml
│ └── _ArticleSummary.cshtml
├── Home
│ ├── About.cshtml
│ ├── Contact.cshtml
│ └── Index.cshtml
├── Manage
│ ├── AddPhoneNumber.cshtml
│ ├── ChangePassword.cshtml
│ ├── Index.cshtml
│ ├── ManageLogins.cshtml
│ ├── SetPassword.cshtml
│ └── VerifyPhoneNumber.cshtml
├── Shared
│ ├── Components
│ │ └── LatestArticles
│ │ │ └── Default.cshtml
│ ├── Error.cshtml
│ ├── _Layout.cshtml
│ ├── _LoginPartial.cshtml
│ └── _ValidationScriptsPartial.cshtml
├── _ViewImports.cshtml
└── _ViewStart.cshtml
├── appsettings.json
├── bin
└── Debug
│ └── netcoreapp1.0
│ ├── BlogPlayground.deps.json
│ ├── BlogPlayground.dll
│ ├── BlogPlayground.pdb
│ ├── BlogPlayground.runtimeconfig.dev.json
│ ├── BlogPlayground.runtimeconfig.json
│ └── d0958e9c-2f96-42be-8c32-48c320f1d5bc_BlogPlayground.dll
├── bower.json
├── bundleconfig.json
├── obj
└── Debug
│ └── netcoreapp1.0
│ ├── .IncrementalCache
│ ├── .SDKVersion
│ ├── BlogPlaygrounddotnet-compile.deps.json
│ ├── dotnet-compile-csc.rsp
│ ├── dotnet-compile.assemblyinfo.cs
│ └── dotnet-compile.rsp
├── project.json
├── project.lock.json
├── web.config
└── wwwroot
├── _references.js
├── css
├── site.css
└── site.min.css
├── favicon.ico
├── images
├── banner1.svg
├── banner2.svg
├── banner3.svg
├── banner4.svg
└── placeholder.png
├── js
├── site.js
└── site.min.js
└── lib
├── bootstrap
├── .bower.json
├── LICENSE
└── dist
│ ├── css
│ ├── bootstrap-theme.css
│ ├── bootstrap-theme.css.map
│ ├── bootstrap-theme.min.css
│ ├── bootstrap-theme.min.css.map
│ ├── bootstrap.css
│ ├── bootstrap.css.map
│ ├── bootstrap.min.css
│ └── bootstrap.min.css.map
│ ├── fonts
│ ├── glyphicons-halflings-regular.eot
│ ├── glyphicons-halflings-regular.svg
│ ├── glyphicons-halflings-regular.ttf
│ ├── glyphicons-halflings-regular.woff
│ └── glyphicons-halflings-regular.woff2
│ └── js
│ ├── bootstrap.js
│ ├── bootstrap.min.js
│ └── npm.js
├── jquery-validation-unobtrusive
├── .bower.json
├── jquery.validate.unobtrusive.js
└── jquery.validate.unobtrusive.min.js
├── jquery-validation
├── .bower.json
├── LICENSE.md
└── dist
│ ├── additional-methods.js
│ ├── additional-methods.min.js
│ ├── jquery.validate.js
│ └── jquery.validate.min.js
└── jquery
├── .bower.json
├── LICENSE.txt
└── dist
├── jquery.js
├── jquery.min.js
└── jquery.min.map
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear in the root of a volume
35 | .DocumentRevisions-V100
36 | .fseventsd
37 | .Spotlight-V100
38 | .TemporaryItems
39 | .Trashes
40 | .VolumeIcon.icns
41 |
42 | # Directories potentially created on remote AFP share
43 | .AppleDB
44 | .AppleDesktop
45 | Network Trash Folder
46 | Temporary Items
47 | .apdisk
48 |
--------------------------------------------------------------------------------
/.vs/BlogPlayground/v14/.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dotnetcurry/asp.net-core-blogging-site/c8b0e0a98e06614d66e4f926d1b8aa5051ab489e/.vs/BlogPlayground/v14/.suo
--------------------------------------------------------------------------------
/.vs/restore.dg:
--------------------------------------------------------------------------------
1 | #:C:\Users\Daniel.Garcia\Documents\Github\BlogPlayground\src\BlogPlayground\BlogPlayground.xproj
2 |
--------------------------------------------------------------------------------
/BlogPlayground.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{7CFDF67D-EAA6-4E28-820E-1B7A39886180}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4BC2A7FA-1DF5-4B8D-8A90-54EC4BE82E8E}"
9 | ProjectSection(SolutionItems) = preProject
10 | global.json = global.json
11 | EndProjectSection
12 | EndProject
13 | Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "BlogPlayground", "src\BlogPlayground\BlogPlayground.xproj", "{0723636E-4E08-41FA-AF4A-5A0FF9EFD926}"
14 | EndProject
15 | Global
16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
17 | Debug|Any CPU = Debug|Any CPU
18 | Release|Any CPU = Release|Any CPU
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {0723636E-4E08-41FA-AF4A-5A0FF9EFD926}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {0723636E-4E08-41FA-AF4A-5A0FF9EFD926}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {0723636E-4E08-41FA-AF4A-5A0FF9EFD926}.Release|Any CPU.ActiveCfg = Release|Any CPU
24 | {0723636E-4E08-41FA-AF4A-5A0FF9EFD926}.Release|Any CPU.Build.0 = Release|Any CPU
25 | EndGlobalSection
26 | GlobalSection(SolutionProperties) = preSolution
27 | HideSolutionNode = FALSE
28 | EndGlobalSection
29 | GlobalSection(NestedProjects) = preSolution
30 | {0723636E-4E08-41FA-AF4A-5A0FF9EFD926} = {7CFDF67D-EAA6-4E28-820E-1B7A39886180}
31 | EndGlobalSection
32 | EndGlobal
33 |
--------------------------------------------------------------------------------
/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "projects": [ "src", "test" ],
3 | "sdk": {
4 | "version": "1.0.0-preview2-003121"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/BlogPlayground/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "wwwroot/lib"
3 | }
4 |
--------------------------------------------------------------------------------
/src/BlogPlayground/BlogPlayground.xproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 14.0
5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
6 |
7 |
8 |
9 | 0723636e-4e08-41fa-af4a-5a0ff9efd926
10 | BlogPlayground
11 | .\obj
12 | .\bin\
13 | v4.5.2
14 |
15 |
16 | 2.0
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/BlogPlayground/BlogPlayground.xproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | IIS Express
5 | false
6 | 600
7 | 600
8 | True
9 | True
10 | False
11 |
12 | BlogPlayground.Data.ApplicationDbContext
13 | False
14 | True
15 | 600
16 |
17 |
--------------------------------------------------------------------------------
/src/BlogPlayground/Controllers/ArticlesController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 | using Microsoft.AspNetCore.Mvc.Rendering;
7 | using Microsoft.EntityFrameworkCore;
8 | using BlogPlayground.Data;
9 | using BlogPlayground.Models;
10 | using Microsoft.AspNetCore.Identity;
11 | using Microsoft.AspNetCore.Authorization;
12 |
13 | namespace BlogPlayground.Controllers
14 | {
15 | public class ArticlesController : Controller
16 | {
17 | private readonly ApplicationDbContext _context;
18 | private readonly UserManager _userManager;
19 |
20 | public ArticlesController(ApplicationDbContext context, UserManager userManager)
21 | {
22 | _context = context;
23 | _userManager = userManager;
24 | }
25 |
26 | // GET: Articles
27 | public async Task Index()
28 | {
29 | var applicationDbContext = _context.Article.Include(a => a.Author);
30 | return View(await applicationDbContext.ToListAsync());
31 | }
32 |
33 | // GET: Articles/Details/5
34 | public async Task Details(int? id)
35 | {
36 | if (id == null)
37 | {
38 | return NotFound();
39 | }
40 |
41 | var article = await _context.Article
42 | .Include(a => a.Author)
43 | .SingleOrDefaultAsync(m => m.ArticleId == id);
44 | if (article == null)
45 | {
46 | return NotFound();
47 | }
48 |
49 | return View(article);
50 | }
51 |
52 | // GET: Articles/Create
53 | [Authorize]
54 | public IActionResult Create()
55 | {
56 | return View();
57 | }
58 |
59 | // POST: Articles/Create
60 | // To protect from overposting attacks, please enable the specific properties you want to bind to, for
61 | // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
62 | [HttpPost]
63 | [ValidateAntiForgeryToken]
64 | [Authorize]
65 | public async Task Create([Bind("Title, Abstract,Contents")] Article article)
66 | {
67 | if (ModelState.IsValid)
68 | {
69 | article.AuthorId = _userManager.GetUserId(this.User);
70 | article.CreatedDate = DateTime.Now;
71 | _context.Add(article);
72 | await _context.SaveChangesAsync();
73 | return RedirectToAction("Index");
74 | }
75 | return View(article);
76 | }
77 |
78 | // GET: Articles/Delete/5
79 | [Authorize]
80 | public async Task Delete(int? id)
81 | {
82 | if (id == null)
83 | {
84 | return NotFound();
85 | }
86 |
87 | var article = await _context.Article.SingleOrDefaultAsync(m => m.ArticleId == id);
88 | if (article == null)
89 | {
90 | return NotFound();
91 | }
92 |
93 | return View(article);
94 | }
95 |
96 | // POST: Articles/Delete/5
97 | [HttpPost, ActionName("Delete")]
98 | [ValidateAntiForgeryToken]
99 | [Authorize]
100 | public async Task DeleteConfirmed(int id)
101 | {
102 | var article = await _context.Article.SingleOrDefaultAsync(m => m.ArticleId == id);
103 | _context.Article.Remove(article);
104 | await _context.SaveChangesAsync();
105 | return RedirectToAction("Index");
106 | }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/src/BlogPlayground/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 |
7 | namespace BlogPlayground.Controllers
8 | {
9 | public class HomeController : Controller
10 | {
11 | public IActionResult Index()
12 | {
13 | return View();
14 | }
15 |
16 | public IActionResult About()
17 | {
18 | ViewData["Message"] = "Your application description page.";
19 |
20 | return View();
21 | }
22 |
23 | public IActionResult Contact()
24 | {
25 | ViewData["Message"] = "Your contact page.";
26 |
27 | return View();
28 | }
29 |
30 | public IActionResult Error()
31 | {
32 | return View();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/BlogPlayground/Data/ApplicationDbContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
6 | using Microsoft.EntityFrameworkCore;
7 | using BlogPlayground.Models;
8 |
9 | namespace BlogPlayground.Data
10 | {
11 | public class ApplicationDbContext : IdentityDbContext
12 | {
13 | public ApplicationDbContext(DbContextOptions options)
14 | : base(options)
15 | {
16 | }
17 |
18 | protected override void OnModelCreating(ModelBuilder builder)
19 | {
20 | base.OnModelCreating(builder);
21 | // Customize the ASP.NET Identity model and override the defaults if needed.
22 | // For example, you can rename the ASP.NET Identity table names and more.
23 | // Add your customizations after calling base.OnModelCreating(builder);
24 | }
25 |
26 | public DbSet Article { get; set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/BlogPlayground/Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.EntityFrameworkCore;
6 | using Microsoft.EntityFrameworkCore.Infrastructure;
7 | using Microsoft.EntityFrameworkCore.Metadata;
8 | using Microsoft.EntityFrameworkCore.Migrations;
9 |
10 | namespace BlogPlayground.Data.Migrations
11 | {
12 | [DbContext(typeof(ApplicationDbContext))]
13 | [Migration("00000000000000_CreateIdentitySchema")]
14 | partial class CreateIdentitySchema
15 | {
16 | protected override void BuildTargetModel(ModelBuilder modelBuilder)
17 | {
18 | modelBuilder
19 | .HasAnnotation("ProductVersion", "1.0.0-rc3")
20 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
21 |
22 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
23 | {
24 | b.Property("Id");
25 |
26 | b.Property("ConcurrencyStamp")
27 | .IsConcurrencyToken();
28 |
29 | b.Property("Name")
30 | .HasAnnotation("MaxLength", 256);
31 |
32 | b.Property("NormalizedName")
33 | .HasAnnotation("MaxLength", 256);
34 |
35 | b.HasKey("Id");
36 |
37 | b.HasIndex("NormalizedName")
38 | .HasName("RoleNameIndex");
39 |
40 | b.ToTable("AspNetRoles");
41 | });
42 |
43 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim", b =>
44 | {
45 | b.Property("Id")
46 | .ValueGeneratedOnAdd();
47 |
48 | b.Property("ClaimType");
49 |
50 | b.Property("ClaimValue");
51 |
52 | b.Property("RoleId")
53 | .IsRequired();
54 |
55 | b.HasKey("Id");
56 |
57 | b.HasIndex("RoleId");
58 |
59 | b.ToTable("AspNetRoleClaims");
60 | });
61 |
62 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim", b =>
63 | {
64 | b.Property("Id")
65 | .ValueGeneratedOnAdd();
66 |
67 | b.Property("ClaimType");
68 |
69 | b.Property("ClaimValue");
70 |
71 | b.Property("UserId")
72 | .IsRequired();
73 |
74 | b.HasKey("Id");
75 |
76 | b.HasIndex("UserId");
77 |
78 | b.ToTable("AspNetUserClaims");
79 | });
80 |
81 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin", b =>
82 | {
83 | b.Property("LoginProvider");
84 |
85 | b.Property("ProviderKey");
86 |
87 | b.Property("ProviderDisplayName");
88 |
89 | b.Property("UserId")
90 | .IsRequired();
91 |
92 | b.HasKey("LoginProvider", "ProviderKey");
93 |
94 | b.HasIndex("UserId");
95 |
96 | b.ToTable("AspNetUserLogins");
97 | });
98 |
99 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole", b =>
100 | {
101 | b.Property("UserId");
102 |
103 | b.Property("RoleId");
104 |
105 | b.HasKey("UserId", "RoleId");
106 |
107 | b.HasIndex("RoleId");
108 |
109 | b.HasIndex("UserId");
110 |
111 | b.ToTable("AspNetUserRoles");
112 | });
113 |
114 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken", b =>
115 | {
116 | b.Property("UserId");
117 |
118 | b.Property("LoginProvider");
119 |
120 | b.Property("Name");
121 |
122 | b.Property("Value");
123 |
124 | b.HasKey("UserId", "LoginProvider", "Name");
125 |
126 | b.ToTable("AspNetUserTokens");
127 | });
128 |
129 | modelBuilder.Entity("BlogPlayground.Models.ApplicationUser", b =>
130 | {
131 | b.Property("Id");
132 |
133 | b.Property("AccessFailedCount");
134 |
135 | b.Property("ConcurrencyStamp")
136 | .IsConcurrencyToken();
137 |
138 | b.Property("Email")
139 | .HasAnnotation("MaxLength", 256);
140 |
141 | b.Property("EmailConfirmed");
142 |
143 | b.Property("LockoutEnabled");
144 |
145 | b.Property("LockoutEnd");
146 |
147 | b.Property("NormalizedEmail")
148 | .HasAnnotation("MaxLength", 256);
149 |
150 | b.Property("NormalizedUserName")
151 | .HasAnnotation("MaxLength", 256);
152 |
153 | b.Property("PasswordHash");
154 |
155 | b.Property("PhoneNumber");
156 |
157 | b.Property("PhoneNumberConfirmed");
158 |
159 | b.Property("SecurityStamp");
160 |
161 | b.Property("TwoFactorEnabled");
162 |
163 | b.Property("UserName")
164 | .HasAnnotation("MaxLength", 256);
165 |
166 | b.HasKey("Id");
167 |
168 | b.HasIndex("NormalizedEmail")
169 | .HasName("EmailIndex");
170 |
171 | b.HasIndex("NormalizedUserName")
172 | .IsUnique()
173 | .HasName("UserNameIndex");
174 |
175 | b.ToTable("AspNetUsers");
176 | });
177 |
178 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim", b =>
179 | {
180 | b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
181 | .WithMany("Claims")
182 | .HasForeignKey("RoleId")
183 | .OnDelete(DeleteBehavior.Cascade);
184 | });
185 |
186 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim", b =>
187 | {
188 | b.HasOne("BlogPlayground.Models.ApplicationUser")
189 | .WithMany("Claims")
190 | .HasForeignKey("UserId")
191 | .OnDelete(DeleteBehavior.Cascade);
192 | });
193 |
194 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin", b =>
195 | {
196 | b.HasOne("BlogPlayground.Models.ApplicationUser")
197 | .WithMany("Logins")
198 | .HasForeignKey("UserId")
199 | .OnDelete(DeleteBehavior.Cascade);
200 | });
201 |
202 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole", b =>
203 | {
204 | b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
205 | .WithMany("Users")
206 | .HasForeignKey("RoleId")
207 | .OnDelete(DeleteBehavior.Cascade);
208 |
209 | b.HasOne("BlogPlayground.Models.ApplicationUser")
210 | .WithMany("Roles")
211 | .HasForeignKey("UserId")
212 | .OnDelete(DeleteBehavior.Cascade);
213 | });
214 | }
215 | }
216 | }
217 |
--------------------------------------------------------------------------------
/src/BlogPlayground/Data/Migrations/00000000000000_CreateIdentitySchema.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.EntityFrameworkCore.Metadata;
6 | using Microsoft.EntityFrameworkCore.Migrations;
7 |
8 | namespace BlogPlayground.Data.Migrations
9 | {
10 | public partial class CreateIdentitySchema : Migration
11 | {
12 | protected override void Up(MigrationBuilder migrationBuilder)
13 | {
14 | migrationBuilder.CreateTable(
15 | name: "AspNetRoles",
16 | columns: table => new
17 | {
18 | Id = table.Column(nullable: false),
19 | ConcurrencyStamp = table.Column(nullable: true),
20 | Name = table.Column(maxLength: 256, nullable: true),
21 | NormalizedName = table.Column(maxLength: 256, nullable: true)
22 | },
23 | constraints: table =>
24 | {
25 | table.PrimaryKey("PK_AspNetRoles", x => x.Id);
26 | });
27 |
28 | migrationBuilder.CreateTable(
29 | name: "AspNetUserTokens",
30 | columns: table => new
31 | {
32 | UserId = table.Column(nullable: false),
33 | LoginProvider = table.Column(nullable: false),
34 | Name = table.Column(nullable: false),
35 | Value = table.Column(nullable: true)
36 | },
37 | constraints: table =>
38 | {
39 | table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
40 | });
41 |
42 | migrationBuilder.CreateTable(
43 | name: "AspNetUsers",
44 | columns: table => new
45 | {
46 | Id = table.Column(nullable: false),
47 | AccessFailedCount = table.Column(nullable: false),
48 | ConcurrencyStamp = table.Column(nullable: true),
49 | Email = table.Column(maxLength: 256, nullable: true),
50 | EmailConfirmed = table.Column(nullable: false),
51 | LockoutEnabled = table.Column(nullable: false),
52 | LockoutEnd = table.Column(nullable: true),
53 | NormalizedEmail = table.Column(maxLength: 256, nullable: true),
54 | NormalizedUserName = table.Column(maxLength: 256, nullable: true),
55 | PasswordHash = table.Column(nullable: true),
56 | PhoneNumber = table.Column(nullable: true),
57 | PhoneNumberConfirmed = table.Column(nullable: false),
58 | SecurityStamp = table.Column(nullable: true),
59 | TwoFactorEnabled = table.Column(nullable: false),
60 | UserName = table.Column(maxLength: 256, nullable: true)
61 | },
62 | constraints: table =>
63 | {
64 | table.PrimaryKey("PK_AspNetUsers", x => x.Id);
65 | });
66 |
67 | migrationBuilder.CreateTable(
68 | name: "AspNetRoleClaims",
69 | columns: table => new
70 | {
71 | Id = table.Column(nullable: false)
72 | .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
73 | ClaimType = table.Column(nullable: true),
74 | ClaimValue = table.Column(nullable: true),
75 | RoleId = table.Column(nullable: false)
76 | },
77 | constraints: table =>
78 | {
79 | table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
80 | table.ForeignKey(
81 | name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
82 | column: x => x.RoleId,
83 | principalTable: "AspNetRoles",
84 | principalColumn: "Id",
85 | onDelete: ReferentialAction.Cascade);
86 | });
87 |
88 | migrationBuilder.CreateTable(
89 | name: "AspNetUserClaims",
90 | columns: table => new
91 | {
92 | Id = table.Column(nullable: false)
93 | .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
94 | ClaimType = table.Column(nullable: true),
95 | ClaimValue = table.Column(nullable: true),
96 | UserId = table.Column(nullable: false)
97 | },
98 | constraints: table =>
99 | {
100 | table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
101 | table.ForeignKey(
102 | name: "FK_AspNetUserClaims_AspNetUsers_UserId",
103 | column: x => x.UserId,
104 | principalTable: "AspNetUsers",
105 | principalColumn: "Id",
106 | onDelete: ReferentialAction.Cascade);
107 | });
108 |
109 | migrationBuilder.CreateTable(
110 | name: "AspNetUserLogins",
111 | columns: table => new
112 | {
113 | LoginProvider = table.Column(nullable: false),
114 | ProviderKey = table.Column(nullable: false),
115 | ProviderDisplayName = table.Column(nullable: true),
116 | UserId = table.Column(nullable: false)
117 | },
118 | constraints: table =>
119 | {
120 | table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
121 | table.ForeignKey(
122 | name: "FK_AspNetUserLogins_AspNetUsers_UserId",
123 | column: x => x.UserId,
124 | principalTable: "AspNetUsers",
125 | principalColumn: "Id",
126 | onDelete: ReferentialAction.Cascade);
127 | });
128 |
129 | migrationBuilder.CreateTable(
130 | name: "AspNetUserRoles",
131 | columns: table => new
132 | {
133 | UserId = table.Column(nullable: false),
134 | RoleId = table.Column(nullable: false)
135 | },
136 | constraints: table =>
137 | {
138 | table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
139 | table.ForeignKey(
140 | name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
141 | column: x => x.RoleId,
142 | principalTable: "AspNetRoles",
143 | principalColumn: "Id",
144 | onDelete: ReferentialAction.Cascade);
145 | table.ForeignKey(
146 | name: "FK_AspNetUserRoles_AspNetUsers_UserId",
147 | column: x => x.UserId,
148 | principalTable: "AspNetUsers",
149 | principalColumn: "Id",
150 | onDelete: ReferentialAction.Cascade);
151 | });
152 |
153 | migrationBuilder.CreateIndex(
154 | name: "RoleNameIndex",
155 | table: "AspNetRoles",
156 | column: "NormalizedName");
157 |
158 | migrationBuilder.CreateIndex(
159 | name: "IX_AspNetRoleClaims_RoleId",
160 | table: "AspNetRoleClaims",
161 | column: "RoleId");
162 |
163 | migrationBuilder.CreateIndex(
164 | name: "IX_AspNetUserClaims_UserId",
165 | table: "AspNetUserClaims",
166 | column: "UserId");
167 |
168 | migrationBuilder.CreateIndex(
169 | name: "IX_AspNetUserLogins_UserId",
170 | table: "AspNetUserLogins",
171 | column: "UserId");
172 |
173 | migrationBuilder.CreateIndex(
174 | name: "IX_AspNetUserRoles_RoleId",
175 | table: "AspNetUserRoles",
176 | column: "RoleId");
177 |
178 | migrationBuilder.CreateIndex(
179 | name: "IX_AspNetUserRoles_UserId",
180 | table: "AspNetUserRoles",
181 | column: "UserId");
182 |
183 | migrationBuilder.CreateIndex(
184 | name: "EmailIndex",
185 | table: "AspNetUsers",
186 | column: "NormalizedEmail");
187 |
188 | migrationBuilder.CreateIndex(
189 | name: "UserNameIndex",
190 | table: "AspNetUsers",
191 | column: "NormalizedUserName",
192 | unique: true);
193 | }
194 |
195 | protected override void Down(MigrationBuilder migrationBuilder)
196 | {
197 | migrationBuilder.DropTable(
198 | name: "AspNetRoleClaims");
199 |
200 | migrationBuilder.DropTable(
201 | name: "AspNetUserClaims");
202 |
203 | migrationBuilder.DropTable(
204 | name: "AspNetUserLogins");
205 |
206 | migrationBuilder.DropTable(
207 | name: "AspNetUserRoles");
208 |
209 | migrationBuilder.DropTable(
210 | name: "AspNetUserTokens");
211 |
212 | migrationBuilder.DropTable(
213 | name: "AspNetRoles");
214 |
215 | migrationBuilder.DropTable(
216 | name: "AspNetUsers");
217 | }
218 | }
219 | }
220 |
--------------------------------------------------------------------------------
/src/BlogPlayground/Data/Migrations/20160910210414_update-profile.Designer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Infrastructure;
4 | using Microsoft.EntityFrameworkCore.Metadata;
5 | using Microsoft.EntityFrameworkCore.Migrations;
6 | using BlogPlayground.Data;
7 |
8 | namespace BlogPlayground.Data.Migrations
9 | {
10 | [DbContext(typeof(ApplicationDbContext))]
11 | [Migration("20160910210414_update-profile")]
12 | partial class updateprofile
13 | {
14 | protected override void BuildTargetModel(ModelBuilder modelBuilder)
15 | {
16 | modelBuilder
17 | .HasAnnotation("ProductVersion", "1.0.0-rtm-21431")
18 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
19 |
20 | modelBuilder.Entity("BlogPlayground.Models.ApplicationUser", b =>
21 | {
22 | b.Property("Id");
23 |
24 | b.Property("AccessFailedCount");
25 |
26 | b.Property("ConcurrencyStamp")
27 | .IsConcurrencyToken();
28 |
29 | b.Property("Email")
30 | .HasAnnotation("MaxLength", 256);
31 |
32 | b.Property("EmailConfirmed");
33 |
34 | b.Property("FullName");
35 |
36 | b.Property("LockoutEnabled");
37 |
38 | b.Property("LockoutEnd");
39 |
40 | b.Property("NormalizedEmail")
41 | .HasAnnotation("MaxLength", 256);
42 |
43 | b.Property("NormalizedUserName")
44 | .HasAnnotation("MaxLength", 256);
45 |
46 | b.Property("PasswordHash");
47 |
48 | b.Property("PhoneNumber");
49 |
50 | b.Property("PhoneNumberConfirmed");
51 |
52 | b.Property("Picture");
53 |
54 | b.Property("SecurityStamp");
55 |
56 | b.Property("TwoFactorEnabled");
57 |
58 | b.Property("UserName")
59 | .HasAnnotation("MaxLength", 256);
60 |
61 | b.HasKey("Id");
62 |
63 | b.HasIndex("NormalizedEmail")
64 | .HasName("EmailIndex");
65 |
66 | b.HasIndex("NormalizedUserName")
67 | .IsUnique()
68 | .HasName("UserNameIndex");
69 |
70 | b.ToTable("AspNetUsers");
71 | });
72 |
73 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
74 | {
75 | b.Property("Id");
76 |
77 | b.Property("ConcurrencyStamp")
78 | .IsConcurrencyToken();
79 |
80 | b.Property("Name")
81 | .HasAnnotation("MaxLength", 256);
82 |
83 | b.Property("NormalizedName")
84 | .HasAnnotation("MaxLength", 256);
85 |
86 | b.HasKey("Id");
87 |
88 | b.HasIndex("NormalizedName")
89 | .HasName("RoleNameIndex");
90 |
91 | b.ToTable("AspNetRoles");
92 | });
93 |
94 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim", b =>
95 | {
96 | b.Property("Id")
97 | .ValueGeneratedOnAdd();
98 |
99 | b.Property("ClaimType");
100 |
101 | b.Property("ClaimValue");
102 |
103 | b.Property("RoleId")
104 | .IsRequired();
105 |
106 | b.HasKey("Id");
107 |
108 | b.HasIndex("RoleId");
109 |
110 | b.ToTable("AspNetRoleClaims");
111 | });
112 |
113 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim", b =>
114 | {
115 | b.Property("Id")
116 | .ValueGeneratedOnAdd();
117 |
118 | b.Property("ClaimType");
119 |
120 | b.Property("ClaimValue");
121 |
122 | b.Property("UserId")
123 | .IsRequired();
124 |
125 | b.HasKey("Id");
126 |
127 | b.HasIndex("UserId");
128 |
129 | b.ToTable("AspNetUserClaims");
130 | });
131 |
132 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin", b =>
133 | {
134 | b.Property("LoginProvider");
135 |
136 | b.Property("ProviderKey");
137 |
138 | b.Property("ProviderDisplayName");
139 |
140 | b.Property("UserId")
141 | .IsRequired();
142 |
143 | b.HasKey("LoginProvider", "ProviderKey");
144 |
145 | b.HasIndex("UserId");
146 |
147 | b.ToTable("AspNetUserLogins");
148 | });
149 |
150 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole", b =>
151 | {
152 | b.Property("UserId");
153 |
154 | b.Property("RoleId");
155 |
156 | b.HasKey("UserId", "RoleId");
157 |
158 | b.HasIndex("RoleId");
159 |
160 | b.HasIndex("UserId");
161 |
162 | b.ToTable("AspNetUserRoles");
163 | });
164 |
165 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken", b =>
166 | {
167 | b.Property("UserId");
168 |
169 | b.Property("LoginProvider");
170 |
171 | b.Property("Name");
172 |
173 | b.Property("Value");
174 |
175 | b.HasKey("UserId", "LoginProvider", "Name");
176 |
177 | b.ToTable("AspNetUserTokens");
178 | });
179 |
180 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim", b =>
181 | {
182 | b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
183 | .WithMany("Claims")
184 | .HasForeignKey("RoleId")
185 | .OnDelete(DeleteBehavior.Cascade);
186 | });
187 |
188 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim", b =>
189 | {
190 | b.HasOne("BlogPlayground.Models.ApplicationUser")
191 | .WithMany("Claims")
192 | .HasForeignKey("UserId")
193 | .OnDelete(DeleteBehavior.Cascade);
194 | });
195 |
196 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin", b =>
197 | {
198 | b.HasOne("BlogPlayground.Models.ApplicationUser")
199 | .WithMany("Logins")
200 | .HasForeignKey("UserId")
201 | .OnDelete(DeleteBehavior.Cascade);
202 | });
203 |
204 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole", b =>
205 | {
206 | b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
207 | .WithMany("Users")
208 | .HasForeignKey("RoleId")
209 | .OnDelete(DeleteBehavior.Cascade);
210 |
211 | b.HasOne("BlogPlayground.Models.ApplicationUser")
212 | .WithMany("Roles")
213 | .HasForeignKey("UserId")
214 | .OnDelete(DeleteBehavior.Cascade);
215 | });
216 | }
217 | }
218 | }
219 |
--------------------------------------------------------------------------------
/src/BlogPlayground/Data/Migrations/20160910210414_update-profile.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Microsoft.EntityFrameworkCore.Migrations;
4 |
5 | namespace BlogPlayground.Data.Migrations
6 | {
7 | public partial class updateprofile : Migration
8 | {
9 | protected override void Up(MigrationBuilder migrationBuilder)
10 | {
11 | migrationBuilder.AddColumn(
12 | name: "FullName",
13 | table: "AspNetUsers",
14 | nullable: true);
15 |
16 | migrationBuilder.AddColumn(
17 | name: "PictureUrl",
18 | table: "AspNetUsers",
19 | nullable: true);
20 | }
21 |
22 | protected override void Down(MigrationBuilder migrationBuilder)
23 | {
24 | migrationBuilder.DropColumn(
25 | name: "FullName",
26 | table: "AspNetUsers");
27 |
28 | migrationBuilder.DropColumn(
29 | name: "PictureUrl",
30 | table: "AspNetUsers");
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/BlogPlayground/Data/Migrations/20160913175647_articles.Designer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Infrastructure;
4 | using Microsoft.EntityFrameworkCore.Metadata;
5 | using Microsoft.EntityFrameworkCore.Migrations;
6 | using BlogPlayground.Data;
7 |
8 | namespace BlogPlayground.Data.Migrations
9 | {
10 | [DbContext(typeof(ApplicationDbContext))]
11 | [Migration("20160913175647_articles")]
12 | partial class articles
13 | {
14 | protected override void BuildTargetModel(ModelBuilder modelBuilder)
15 | {
16 | modelBuilder
17 | .HasAnnotation("ProductVersion", "1.0.0-rtm-21431")
18 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
19 |
20 | modelBuilder.Entity("BlogPlayground.Models.ApplicationUser", b =>
21 | {
22 | b.Property("Id");
23 |
24 | b.Property("AccessFailedCount");
25 |
26 | b.Property("ConcurrencyStamp")
27 | .IsConcurrencyToken();
28 |
29 | b.Property("Email")
30 | .HasAnnotation("MaxLength", 256);
31 |
32 | b.Property("EmailConfirmed");
33 |
34 | b.Property("FullName");
35 |
36 | b.Property("LockoutEnabled");
37 |
38 | b.Property("LockoutEnd");
39 |
40 | b.Property("NormalizedEmail")
41 | .HasAnnotation("MaxLength", 256);
42 |
43 | b.Property("NormalizedUserName")
44 | .HasAnnotation("MaxLength", 256);
45 |
46 | b.Property("PasswordHash");
47 |
48 | b.Property("PhoneNumber");
49 |
50 | b.Property("PhoneNumberConfirmed");
51 |
52 | b.Property("PictureUrl");
53 |
54 | b.Property("SecurityStamp");
55 |
56 | b.Property("TwoFactorEnabled");
57 |
58 | b.Property("UserName")
59 | .HasAnnotation("MaxLength", 256);
60 |
61 | b.HasKey("Id");
62 |
63 | b.HasIndex("NormalizedEmail")
64 | .HasName("EmailIndex");
65 |
66 | b.HasIndex("NormalizedUserName")
67 | .IsUnique()
68 | .HasName("UserNameIndex");
69 |
70 | b.ToTable("AspNetUsers");
71 | });
72 |
73 | modelBuilder.Entity("BlogPlayground.Models.Article", b =>
74 | {
75 | b.Property("ArticleId")
76 | .ValueGeneratedOnAdd();
77 |
78 | b.Property("Abstract")
79 | .IsRequired();
80 |
81 | b.Property("AuthorId");
82 |
83 | b.Property("Contents")
84 | .IsRequired();
85 |
86 | b.Property("CreatedDate");
87 |
88 | b.Property("Title")
89 | .IsRequired();
90 |
91 | b.HasKey("ArticleId");
92 |
93 | b.HasIndex("AuthorId");
94 |
95 | b.ToTable("Article");
96 | });
97 |
98 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
99 | {
100 | b.Property("Id");
101 |
102 | b.Property("ConcurrencyStamp")
103 | .IsConcurrencyToken();
104 |
105 | b.Property("Name")
106 | .HasAnnotation("MaxLength", 256);
107 |
108 | b.Property("NormalizedName")
109 | .HasAnnotation("MaxLength", 256);
110 |
111 | b.HasKey("Id");
112 |
113 | b.HasIndex("NormalizedName")
114 | .HasName("RoleNameIndex");
115 |
116 | b.ToTable("AspNetRoles");
117 | });
118 |
119 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim", b =>
120 | {
121 | b.Property("Id")
122 | .ValueGeneratedOnAdd();
123 |
124 | b.Property("ClaimType");
125 |
126 | b.Property("ClaimValue");
127 |
128 | b.Property("RoleId")
129 | .IsRequired();
130 |
131 | b.HasKey("Id");
132 |
133 | b.HasIndex("RoleId");
134 |
135 | b.ToTable("AspNetRoleClaims");
136 | });
137 |
138 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim", b =>
139 | {
140 | b.Property("Id")
141 | .ValueGeneratedOnAdd();
142 |
143 | b.Property("ClaimType");
144 |
145 | b.Property("ClaimValue");
146 |
147 | b.Property("UserId")
148 | .IsRequired();
149 |
150 | b.HasKey("Id");
151 |
152 | b.HasIndex("UserId");
153 |
154 | b.ToTable("AspNetUserClaims");
155 | });
156 |
157 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin", b =>
158 | {
159 | b.Property("LoginProvider");
160 |
161 | b.Property("ProviderKey");
162 |
163 | b.Property("ProviderDisplayName");
164 |
165 | b.Property("UserId")
166 | .IsRequired();
167 |
168 | b.HasKey("LoginProvider", "ProviderKey");
169 |
170 | b.HasIndex("UserId");
171 |
172 | b.ToTable("AspNetUserLogins");
173 | });
174 |
175 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole", b =>
176 | {
177 | b.Property("UserId");
178 |
179 | b.Property("RoleId");
180 |
181 | b.HasKey("UserId", "RoleId");
182 |
183 | b.HasIndex("RoleId");
184 |
185 | b.HasIndex("UserId");
186 |
187 | b.ToTable("AspNetUserRoles");
188 | });
189 |
190 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken", b =>
191 | {
192 | b.Property("UserId");
193 |
194 | b.Property("LoginProvider");
195 |
196 | b.Property("Name");
197 |
198 | b.Property("Value");
199 |
200 | b.HasKey("UserId", "LoginProvider", "Name");
201 |
202 | b.ToTable("AspNetUserTokens");
203 | });
204 |
205 | modelBuilder.Entity("BlogPlayground.Models.Article", b =>
206 | {
207 | b.HasOne("BlogPlayground.Models.ApplicationUser", "Author")
208 | .WithMany()
209 | .HasForeignKey("AuthorId");
210 | });
211 |
212 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim", b =>
213 | {
214 | b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
215 | .WithMany("Claims")
216 | .HasForeignKey("RoleId")
217 | .OnDelete(DeleteBehavior.Cascade);
218 | });
219 |
220 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim", b =>
221 | {
222 | b.HasOne("BlogPlayground.Models.ApplicationUser")
223 | .WithMany("Claims")
224 | .HasForeignKey("UserId")
225 | .OnDelete(DeleteBehavior.Cascade);
226 | });
227 |
228 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin", b =>
229 | {
230 | b.HasOne("BlogPlayground.Models.ApplicationUser")
231 | .WithMany("Logins")
232 | .HasForeignKey("UserId")
233 | .OnDelete(DeleteBehavior.Cascade);
234 | });
235 |
236 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole", b =>
237 | {
238 | b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
239 | .WithMany("Users")
240 | .HasForeignKey("RoleId")
241 | .OnDelete(DeleteBehavior.Cascade);
242 |
243 | b.HasOne("BlogPlayground.Models.ApplicationUser")
244 | .WithMany("Roles")
245 | .HasForeignKey("UserId")
246 | .OnDelete(DeleteBehavior.Cascade);
247 | });
248 | }
249 | }
250 | }
251 |
--------------------------------------------------------------------------------
/src/BlogPlayground/Data/Migrations/20160913175647_articles.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Microsoft.EntityFrameworkCore.Migrations;
4 | using Microsoft.EntityFrameworkCore.Metadata;
5 |
6 | namespace BlogPlayground.Data.Migrations
7 | {
8 | public partial class articles : Migration
9 | {
10 | protected override void Up(MigrationBuilder migrationBuilder)
11 | {
12 | migrationBuilder.CreateTable(
13 | name: "Article",
14 | columns: table => new
15 | {
16 | ArticleId = table.Column(nullable: false)
17 | .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
18 | Abstract = table.Column(nullable: false),
19 | AuthorId = table.Column(nullable: true),
20 | Contents = table.Column(nullable: false),
21 | CreatedDate = table.Column(nullable: false),
22 | Title = table.Column(nullable: false)
23 | },
24 | constraints: table =>
25 | {
26 | table.PrimaryKey("PK_Article", x => x.ArticleId);
27 | table.ForeignKey(
28 | name: "FK_Article_AspNetUsers_AuthorId",
29 | column: x => x.AuthorId,
30 | principalTable: "AspNetUsers",
31 | principalColumn: "Id",
32 | onDelete: ReferentialAction.Restrict);
33 | });
34 |
35 | migrationBuilder.CreateIndex(
36 | name: "IX_Article_AuthorId",
37 | table: "Article",
38 | column: "AuthorId");
39 | }
40 |
41 | protected override void Down(MigrationBuilder migrationBuilder)
42 | {
43 | migrationBuilder.DropTable(
44 | name: "Article");
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/BlogPlayground/Data/Migrations/ApplicationDbContextModelSnapshot.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Infrastructure;
4 | using Microsoft.EntityFrameworkCore.Metadata;
5 | using Microsoft.EntityFrameworkCore.Migrations;
6 | using BlogPlayground.Data;
7 |
8 | namespace BlogPlayground.Data.Migrations
9 | {
10 | [DbContext(typeof(ApplicationDbContext))]
11 | partial class ApplicationDbContextModelSnapshot : ModelSnapshot
12 | {
13 | protected override void BuildModel(ModelBuilder modelBuilder)
14 | {
15 | modelBuilder
16 | .HasAnnotation("ProductVersion", "1.0.0-rtm-21431")
17 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
18 |
19 | modelBuilder.Entity("BlogPlayground.Models.ApplicationUser", b =>
20 | {
21 | b.Property("Id");
22 |
23 | b.Property("AccessFailedCount");
24 |
25 | b.Property("ConcurrencyStamp")
26 | .IsConcurrencyToken();
27 |
28 | b.Property("Email")
29 | .HasAnnotation("MaxLength", 256);
30 |
31 | b.Property("EmailConfirmed");
32 |
33 | b.Property("FullName");
34 |
35 | b.Property("LockoutEnabled");
36 |
37 | b.Property("LockoutEnd");
38 |
39 | b.Property("NormalizedEmail")
40 | .HasAnnotation("MaxLength", 256);
41 |
42 | b.Property("NormalizedUserName")
43 | .HasAnnotation("MaxLength", 256);
44 |
45 | b.Property("PasswordHash");
46 |
47 | b.Property("PhoneNumber");
48 |
49 | b.Property("PhoneNumberConfirmed");
50 |
51 | b.Property("PictureUrl");
52 |
53 | b.Property("SecurityStamp");
54 |
55 | b.Property("TwoFactorEnabled");
56 |
57 | b.Property("UserName")
58 | .HasAnnotation("MaxLength", 256);
59 |
60 | b.HasKey("Id");
61 |
62 | b.HasIndex("NormalizedEmail")
63 | .HasName("EmailIndex");
64 |
65 | b.HasIndex("NormalizedUserName")
66 | .IsUnique()
67 | .HasName("UserNameIndex");
68 |
69 | b.ToTable("AspNetUsers");
70 | });
71 |
72 | modelBuilder.Entity("BlogPlayground.Models.Article", b =>
73 | {
74 | b.Property("ArticleId")
75 | .ValueGeneratedOnAdd();
76 |
77 | b.Property("Abstract")
78 | .IsRequired();
79 |
80 | b.Property("AuthorId");
81 |
82 | b.Property("Contents")
83 | .IsRequired();
84 |
85 | b.Property("CreatedDate");
86 |
87 | b.Property("Title")
88 | .IsRequired();
89 |
90 | b.HasKey("ArticleId");
91 |
92 | b.HasIndex("AuthorId");
93 |
94 | b.ToTable("Article");
95 | });
96 |
97 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
98 | {
99 | b.Property("Id");
100 |
101 | b.Property("ConcurrencyStamp")
102 | .IsConcurrencyToken();
103 |
104 | b.Property("Name")
105 | .HasAnnotation("MaxLength", 256);
106 |
107 | b.Property("NormalizedName")
108 | .HasAnnotation("MaxLength", 256);
109 |
110 | b.HasKey("Id");
111 |
112 | b.HasIndex("NormalizedName")
113 | .HasName("RoleNameIndex");
114 |
115 | b.ToTable("AspNetRoles");
116 | });
117 |
118 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim", b =>
119 | {
120 | b.Property("Id")
121 | .ValueGeneratedOnAdd();
122 |
123 | b.Property("ClaimType");
124 |
125 | b.Property("ClaimValue");
126 |
127 | b.Property("RoleId")
128 | .IsRequired();
129 |
130 | b.HasKey("Id");
131 |
132 | b.HasIndex("RoleId");
133 |
134 | b.ToTable("AspNetRoleClaims");
135 | });
136 |
137 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim", b =>
138 | {
139 | b.Property("Id")
140 | .ValueGeneratedOnAdd();
141 |
142 | b.Property("ClaimType");
143 |
144 | b.Property("ClaimValue");
145 |
146 | b.Property("UserId")
147 | .IsRequired();
148 |
149 | b.HasKey("Id");
150 |
151 | b.HasIndex("UserId");
152 |
153 | b.ToTable("AspNetUserClaims");
154 | });
155 |
156 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin", b =>
157 | {
158 | b.Property("LoginProvider");
159 |
160 | b.Property("ProviderKey");
161 |
162 | b.Property("ProviderDisplayName");
163 |
164 | b.Property("UserId")
165 | .IsRequired();
166 |
167 | b.HasKey("LoginProvider", "ProviderKey");
168 |
169 | b.HasIndex("UserId");
170 |
171 | b.ToTable("AspNetUserLogins");
172 | });
173 |
174 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole", b =>
175 | {
176 | b.Property("UserId");
177 |
178 | b.Property("RoleId");
179 |
180 | b.HasKey("UserId", "RoleId");
181 |
182 | b.HasIndex("RoleId");
183 |
184 | b.HasIndex("UserId");
185 |
186 | b.ToTable("AspNetUserRoles");
187 | });
188 |
189 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken", b =>
190 | {
191 | b.Property("UserId");
192 |
193 | b.Property("LoginProvider");
194 |
195 | b.Property("Name");
196 |
197 | b.Property("Value");
198 |
199 | b.HasKey("UserId", "LoginProvider", "Name");
200 |
201 | b.ToTable("AspNetUserTokens");
202 | });
203 |
204 | modelBuilder.Entity("BlogPlayground.Models.Article", b =>
205 | {
206 | b.HasOne("BlogPlayground.Models.ApplicationUser", "Author")
207 | .WithMany()
208 | .HasForeignKey("AuthorId");
209 | });
210 |
211 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim", b =>
212 | {
213 | b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
214 | .WithMany("Claims")
215 | .HasForeignKey("RoleId")
216 | .OnDelete(DeleteBehavior.Cascade);
217 | });
218 |
219 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim