├── Areas
└── Identity
│ ├── IdentityHostingStartup.cs
│ └── Pages
│ ├── Account
│ ├── Login.cshtml
│ ├── Login.cshtml.cs
│ ├── Manage
│ │ ├── Index.cshtml
│ │ ├── Index.cshtml.cs
│ │ └── _ViewImports.cshtml
│ ├── Register.cshtml
│ ├── Register.cshtml.cs
│ └── _ViewImports.cshtml
│ ├── _ValidationScriptsPartial.cshtml
│ ├── _ViewImports.cshtml
│ └── _ViewStart.cshtml
├── Controllers
└── TweetController.cs
├── Data
├── ApplicationDbContext.cs
└── Migrations
│ ├── 00000000000000_CreateIdentitySchema.Designer.cs
│ ├── 00000000000000_CreateIdentitySchema.cs
│ ├── 20180824202814_InitialCreate.Designer.cs
│ ├── 20180824202814_InitialCreate.cs
│ ├── 20180827150655_test.Designer.cs
│ ├── 20180827150655_test.cs
│ ├── 20180827165512_ChangetoTweet.Designer.cs
│ ├── 20180827165512_ChangetoTweet.cs
│ ├── 20180827170826_ChangeProperties.Designer.cs
│ ├── 20180827170826_ChangeProperties.cs
│ ├── 20180827171952_Change.Designer.cs
│ ├── 20180827171952_Change.cs
│ └── ApplicationDbContextModelSnapshot.cs
├── Jetweet.csproj
├── LICENSE
├── Models
├── ErrorViewModel.cs
└── Tweet.cs
├── Program.cs
├── Properties
└── launchSettings.json
├── README.md
├── Startup.cs
├── Views
├── Shared
│ ├── Error.cshtml
│ ├── _CookieConsentPartial.cshtml
│ ├── _Layout.cshtml
│ ├── _LoginPartial.cshtml
│ └── _ValidationScriptsPartial.cshtml
├── Tweet
│ ├── Create.cshtml
│ ├── Details.cshtml
│ ├── Edit.cshtml
│ └── Index.cshtml
├── _ViewImports.cshtml
└── _ViewStart.cshtml
├── app.db
├── appsettings.Development.json
├── appsettings.json
└── wwwroot
├── css
├── site.css
└── site.min.css
├── favicon.ico
├── images
├── avatar.jpg
├── banner1.svg
├── banner2.svg
├── banner3.svg
└── cover.jpg
├── js
├── site.js
└── site.min.js
└── lib
├── bootstrap
├── LICENSE
└── dist
│ ├── css
│ ├── bootstrap-grid.css
│ ├── bootstrap-grid.css.map
│ ├── bootstrap-grid.min.css
│ ├── bootstrap-grid.min.css.map
│ ├── bootstrap-reboot.css
│ ├── bootstrap-reboot.css.map
│ ├── bootstrap-reboot.min.css
│ ├── bootstrap-reboot.min.css.map
│ ├── bootstrap.css
│ ├── bootstrap.css.map
│ ├── bootstrap.min.css
│ └── bootstrap.min.css.map
│ └── js
│ ├── bootstrap.bundle.js
│ ├── bootstrap.bundle.js.map
│ ├── bootstrap.bundle.min.js
│ ├── bootstrap.bundle.min.js.map
│ ├── bootstrap.js
│ ├── bootstrap.js.map
│ ├── bootstrap.min.js
│ └── bootstrap.min.js.map
├── jquery-validation-unobtrusive
├── LICENSE.txt
├── 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
/Areas/Identity/IdentityHostingStartup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.AspNetCore.Identity;
4 | using Microsoft.AspNetCore.Identity.UI;
5 | using Microsoft.EntityFrameworkCore;
6 | using Microsoft.Extensions.Configuration;
7 | using Microsoft.Extensions.DependencyInjection;
8 | using Jetweet.Areas.Identity;
9 | using Jetweet.Data;
10 |
11 | [assembly : HostingStartup (typeof (IdentityHostingStartup))]
12 |
13 | namespace Jetweet.Areas.Identity {
14 | public class IdentityHostingStartup : IHostingStartup {
15 | public void Configure (IWebHostBuilder builder) {
16 | builder.ConfigureServices ((context, services) => { });
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/Areas/Identity/Pages/Account/Login.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model LoginModel
3 |
4 | @{
5 | ViewData["Title"] = "Log in";
6 | }
7 |
8 |
49 |
50 | @section Scripts {
51 |
52 | }
--------------------------------------------------------------------------------
/Areas/Identity/Pages/Account/Login.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Authentication;
7 | using Microsoft.AspNetCore.Authorization;
8 | using Microsoft.AspNetCore.Identity;
9 | using Microsoft.AspNetCore.Mvc;
10 | using Microsoft.AspNetCore.Mvc.RazorPages;
11 | using Microsoft.Extensions.Logging;
12 |
13 | namespace Jetweet.Areas.Identity.Pages.Account {
14 | [AllowAnonymous]
15 | public class LoginModel : PageModel {
16 | private readonly ILogger _logger;
17 | private readonly SignInManager _signInManager;
18 |
19 | public LoginModel (SignInManager signInManager, ILogger logger) {
20 | _signInManager = signInManager;
21 | _logger = logger;
22 | }
23 |
24 | [BindProperty] public InputModel Input { get; set; }
25 |
26 | public IList ExternalLogins { get; set; }
27 |
28 | public string ReturnUrl { get; set; }
29 |
30 | [TempData] public string ErrorMessage { get; set; }
31 |
32 | public async Task OnGetAsync (string returnUrl = null) {
33 | if (!string.IsNullOrEmpty (ErrorMessage)) {
34 | ModelState.AddModelError (string.Empty, ErrorMessage);
35 | }
36 |
37 | returnUrl = returnUrl ?? Url.Content ("~/");
38 |
39 | // Clear the existing external cookie to ensure a clean login process
40 | await HttpContext.SignOutAsync (IdentityConstants.ExternalScheme);
41 |
42 | ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync ()).ToList ();
43 |
44 | ReturnUrl = returnUrl;
45 | }
46 |
47 | public async Task OnPostAsync (string returnUrl = null) {
48 | returnUrl = returnUrl ?? Url.Content ("~/");
49 |
50 | if (ModelState.IsValid) {
51 | // This doesn't count login failures towards account lockout
52 | // To enable password failures to trigger account lockout, set lockoutOnFailure: true
53 | var result = await _signInManager.PasswordSignInAsync (Input.Username, Input.Password, Input.RememberMe,
54 | lockoutOnFailure : false);
55 | Console.WriteLine ("\n\n\n" + Input.Username + "\n" + Input.Password + "\n" +
56 | result + "\n\n\n");
57 | if (result.Succeeded) {
58 | _logger.LogInformation ("User logged in.");
59 | return LocalRedirect (returnUrl);
60 | }
61 |
62 | if (result.RequiresTwoFactor) {
63 | return RedirectToPage ("./LoginWith2fa", new { ReturnUrl = returnUrl, RememberMe = Input.RememberMe });
64 | }
65 |
66 | if (result.IsLockedOut) {
67 | _logger.LogWarning ("User account locked out.");
68 | return RedirectToPage ("./Lockout");
69 | } else {
70 | ModelState.AddModelError (string.Empty, "Invalid login attempt.");
71 | return Page ();
72 | }
73 | }
74 |
75 | // If we got this far, something failed, redisplay form
76 | return Page ();
77 | }
78 |
79 | public class InputModel {
80 | [Required]
81 | [Display (Name = "Username")]
82 | public string Username { get; set; }
83 |
84 | [Required]
85 | [DataType (DataType.Password)]
86 | [Display (Name = "Password")]
87 | public string Password { get; set; }
88 |
89 | [Display (Name = "Remember me?")] public bool RememberMe { get; set; }
90 | }
91 | }
92 | }
--------------------------------------------------------------------------------
/Areas/Identity/Pages/Account/Manage/Index.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model IndexModel
3 | @{
4 | ViewData["Title"] = "Profile";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
44 |
45 | @section Scripts {
46 |
47 | }
--------------------------------------------------------------------------------
/Areas/Identity/Pages/Account/Manage/Index.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Text.Encodings.Web;
6 | using System.Threading.Tasks;
7 | using Microsoft.AspNetCore.Identity;
8 | using Microsoft.AspNetCore.Identity.UI.Services;
9 | using Microsoft.AspNetCore.Mvc;
10 | using Microsoft.AspNetCore.Mvc.RazorPages;
11 |
12 | namespace Jetweet.Areas.Identity.Pages.Account.Manage {
13 | public partial class IndexModel : PageModel {
14 | private readonly IEmailSender _emailSender;
15 | private readonly SignInManager _signInManager;
16 | private readonly UserManager _userManager;
17 |
18 | public IndexModel (
19 | UserManager userManager,
20 | SignInManager signInManager,
21 | IEmailSender emailSender) {
22 | _userManager = userManager;
23 | _signInManager = signInManager;
24 | _emailSender = emailSender;
25 | }
26 |
27 | public string Username { get; set; }
28 |
29 | public bool IsEmailConfirmed { get; set; }
30 |
31 | [TempData] public string StatusMessage { get; set; }
32 |
33 | [BindProperty] public InputModel Input { get; set; }
34 |
35 | public async Task OnGetAsync () {
36 | var user = await _userManager.GetUserAsync (User);
37 | if (user == null) {
38 | return NotFound ($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
39 | }
40 |
41 | var userName = await _userManager.GetUserNameAsync (user);
42 | var email = await _userManager.GetEmailAsync (user);
43 | var phoneNumber = await _userManager.GetPhoneNumberAsync (user);
44 |
45 | Username = userName;
46 |
47 | Input = new InputModel {
48 | Email = email,
49 | PhoneNumber = phoneNumber
50 | };
51 |
52 | IsEmailConfirmed = await _userManager.IsEmailConfirmedAsync (user);
53 |
54 | return Page ();
55 | }
56 |
57 | public async Task OnPostAsync () {
58 | if (!ModelState.IsValid) {
59 | return Page ();
60 | }
61 |
62 | var user = await _userManager.GetUserAsync (User);
63 | if (user == null) {
64 | return NotFound ($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
65 | }
66 |
67 | var email = await _userManager.GetEmailAsync (user);
68 | if (Input.Email != email) {
69 | var setEmailResult = await _userManager.SetEmailAsync (user, Input.Email);
70 | if (!setEmailResult.Succeeded) {
71 | var userId = await _userManager.GetUserIdAsync (user);
72 | throw new InvalidOperationException ($"Unexpected error occurred setting email for user with ID '{userId}'.");
73 | }
74 | }
75 |
76 | var phoneNumber = await _userManager.GetPhoneNumberAsync (user);
77 | if (Input.PhoneNumber != phoneNumber) {
78 | var setPhoneResult = await _userManager.SetPhoneNumberAsync (user, Input.PhoneNumber);
79 | if (!setPhoneResult.Succeeded) {
80 | var userId = await _userManager.GetUserIdAsync (user);
81 | throw new InvalidOperationException (
82 | $"Unexpected error occurred setting phone number for user with ID '{userId}'.");
83 | }
84 | }
85 |
86 | await _signInManager.RefreshSignInAsync (user);
87 | StatusMessage = "Your profile has been updated";
88 | return RedirectToPage ();
89 | }
90 |
91 | public async Task OnPostSendVerificationEmailAsync () {
92 | if (!ModelState.IsValid) {
93 | return Page ();
94 | }
95 |
96 | var user = await _userManager.GetUserAsync (User);
97 | if (user == null) {
98 | return NotFound ($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
99 | }
100 |
101 | var userId = await _userManager.GetUserIdAsync (user);
102 | var email = await _userManager.GetEmailAsync (user);
103 | var code = await _userManager.GenerateEmailConfirmationTokenAsync (user);
104 | var callbackUrl = Url.Page (
105 | "/Account/ConfirmEmail",
106 | pageHandler : null,
107 | values : new { userId = userId, code = code },
108 | protocol : Request.Scheme);
109 | await _emailSender.SendEmailAsync (
110 | email,
111 | "Confirm your email",
112 | $"Please confirm your account by clicking here.");
113 |
114 | StatusMessage = "Verification email sent. Please check your email.";
115 | return RedirectToPage ();
116 | }
117 |
118 | public class InputModel {
119 | [Required][EmailAddress] public string Email { get; set; }
120 |
121 | [Phone]
122 | [Display (Name = "Phone number")]
123 | public string PhoneNumber { get; set; }
124 | }
125 | }
126 | }
--------------------------------------------------------------------------------
/Areas/Identity/Pages/Account/Manage/_ViewImports.cshtml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JetLightStudio/Jetweet/32fd5905eac279b368cb83c0ab51176e87119966/Areas/Identity/Pages/Account/Manage/_ViewImports.cshtml
--------------------------------------------------------------------------------
/Areas/Identity/Pages/Account/Register.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model RegisterModel
3 | @{
4 | ViewData["Title"] = "Register";
5 | }
6 |
7 |
37 |
38 | @section Scripts {
39 |
40 | }
--------------------------------------------------------------------------------
/Areas/Identity/Pages/Account/Register.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Text.Encodings.Web;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Authorization;
7 | using Microsoft.AspNetCore.Identity;
8 | using Microsoft.AspNetCore.Identity.UI.Services;
9 | using Microsoft.AspNetCore.Mvc;
10 | using Microsoft.AspNetCore.Mvc.RazorPages;
11 | using Microsoft.Extensions.Logging;
12 |
13 | namespace Jetweet.Areas.Identity.Pages.Account {
14 | [AllowAnonymous]
15 | public class RegisterModel : PageModel {
16 | private readonly IEmailSender _emailSender;
17 | private readonly ILogger _logger;
18 | private readonly SignInManager _signInManager;
19 | private readonly UserManager _userManager;
20 |
21 | public RegisterModel (
22 | UserManager userManager,
23 | SignInManager signInManager,
24 | ILogger logger,
25 | IEmailSender emailSender) {
26 | _userManager = userManager;
27 | _signInManager = signInManager;
28 | _logger = logger;
29 | _emailSender = emailSender;
30 | }
31 |
32 | [BindProperty] public InputModel Input { get; set; }
33 |
34 | public string ReturnUrl { get; set; }
35 |
36 | public void OnGet (string returnUrl = null) {
37 | ReturnUrl = returnUrl;
38 | }
39 |
40 | public async Task OnPostAsync (string returnUrl = null) {
41 | returnUrl = returnUrl ?? Url.Content ("~/");
42 | if (ModelState.IsValid) {
43 | var user = new IdentityUser { UserName = Input.Username, Email = Input.Email };
44 | var result = await _userManager.CreateAsync (user, Input.Password);
45 | if (result.Succeeded) {
46 | _logger.LogInformation ("User created a new account with password.");
47 |
48 | var code = await _userManager.GenerateEmailConfirmationTokenAsync (user);
49 | var callbackUrl = Url.Page (
50 | "/Account/ConfirmEmail",
51 | pageHandler : null,
52 | values : new { userId = user.Id, code = code },
53 | protocol : Request.Scheme);
54 |
55 | await _emailSender.SendEmailAsync (Input.Email, "Confirm your email",
56 | $"Please confirm your account by clicking here.");
57 |
58 | await _signInManager.SignInAsync (user, isPersistent : false);
59 | return LocalRedirect (returnUrl);
60 | }
61 |
62 | foreach (var error in result.Errors) {
63 | ModelState.AddModelError (string.Empty, error.Description);
64 | }
65 | }
66 |
67 | // If we got this far, something failed, redisplay form
68 | return Page ();
69 | }
70 |
71 | public class InputModel {
72 | [Required]
73 | [Display (Name = "Username")]
74 | public string Username { get; set; }
75 |
76 | [Required]
77 | [EmailAddress]
78 | [Display (Name = "Email")]
79 | public string Email { get; set; }
80 |
81 | [Required]
82 | [StringLength (100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.",
83 | MinimumLength = 6)]
84 | [DataType (DataType.Password)]
85 | [Display (Name = "Password")]
86 | public string Password { get; set; }
87 |
88 | [DataType (DataType.Password)]
89 | [Display (Name = "Confirm password")]
90 | [Compare ("Password", ErrorMessage = "The password and confirmation password do not match.")]
91 | public string ConfirmPassword { get; set; }
92 | }
93 | }
94 | }
--------------------------------------------------------------------------------
/Areas/Identity/Pages/Account/_ViewImports.cshtml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JetLightStudio/Jetweet/32fd5905eac279b368cb83c0ab51176e87119966/Areas/Identity/Pages/Account/_ViewImports.cshtml
--------------------------------------------------------------------------------
/Areas/Identity/Pages/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
--------------------------------------------------------------------------------
/Areas/Identity/Pages/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @namespace Jetweet.Areas.Identity.Pages
2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
--------------------------------------------------------------------------------
/Areas/Identity/Pages/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "/Views/Shared/_Layout.cshtml";
3 | }
--------------------------------------------------------------------------------
/Controllers/TweetController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Microsoft.AspNetCore.Mvc.Rendering;
8 | using Microsoft.EntityFrameworkCore;
9 | using Jetweet.Data;
10 | using Jetweet.Models;
11 |
12 | namespace Jetweet.Controllers {
13 | public class TweetController : Controller {
14 | private readonly ApplicationDbContext _context;
15 |
16 | public TweetController (ApplicationDbContext context) {
17 | _context = context;
18 | }
19 |
20 | // GET: Tweet
21 | public async Task Index () {
22 | if (User.Identity.IsAuthenticated) {
23 | return View (await _context.Tweet.OrderByDescending (d => d.Id).ToListAsync ());
24 | } else {
25 | return Redirect ("/Identity/Account/Login");
26 | }
27 | }
28 |
29 | // GET: Tweet/Details/5
30 | public async Task Details (int? id) {
31 | if (id == null) {
32 | return NotFound ();
33 | }
34 |
35 | var Tweet = await _context.Tweet
36 | .FirstOrDefaultAsync (m => m.Id == id);
37 | if (Tweet == null) {
38 | return NotFound ();
39 | }
40 |
41 | return View (Tweet);
42 | }
43 |
44 | // GET: Tweet/Create
45 | public IActionResult Create () {
46 | if (User.Identity.IsAuthenticated) {
47 | return View ();
48 | } else {
49 | return RedirectToAction (actionName: "Index");
50 | }
51 | }
52 |
53 | // POST: Tweet/Create
54 | // To protect from overposting attacks, please enable the specific properties you want to bind to, for
55 | // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
56 | [HttpPost]
57 | [ValidateAntiForgeryToken]
58 | public async Task Create ([Bind ("Id,Text,ImageUrl")] Tweet Tweet) {
59 | if (ModelState.IsValid) {
60 | _context.Add (Tweet);
61 | await _context.SaveChangesAsync ();
62 | return RedirectToAction (nameof (Index));
63 | }
64 |
65 | return View (Tweet);
66 | }
67 |
68 | // GET: Tweet/Edit/5
69 | public async Task Edit (int? id) {
70 | if (id == null) {
71 | return NotFound ();
72 | }
73 |
74 | var Tweet = await _context.Tweet.FindAsync (id);
75 | if (Tweet == null) {
76 | return NotFound ();
77 | }
78 |
79 | return View (Tweet);
80 | }
81 |
82 | // POST: Tweet/Edit/5
83 | // To protect from overposting attacks, please enable the specific properties you want to bind to, for
84 | // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
85 | [HttpPost]
86 | [ValidateAntiForgeryToken]
87 | public async Task Edit (int id, [Bind ("Id,Text,ImageUrl")] Tweet Tweet) {
88 | if (id != Tweet.Id) {
89 | return NotFound ();
90 | }
91 |
92 | if (ModelState.IsValid) {
93 | try {
94 | _context.Update (Tweet);
95 | await _context.SaveChangesAsync ();
96 | } catch (DbUpdateConcurrencyException) {
97 | if (!TweetExists (Tweet.Id)) {
98 | return NotFound ();
99 | } else {
100 | throw;
101 | }
102 | }
103 |
104 | return RedirectToAction (nameof (Index));
105 | }
106 |
107 | return View (Tweet);
108 | }
109 |
110 | // GET: Tweet/Delete/5
111 | public async Task Delete (int? id) {
112 | if (id == null) {
113 | return NotFound ();
114 | }
115 |
116 | var Tweet = await _context.Tweet
117 | .FirstOrDefaultAsync (m => m.Id == id);
118 | if (Tweet == null) {
119 | return NotFound ();
120 | }
121 |
122 | return View (Tweet);
123 | }
124 |
125 | // POST: Tweet/Delete/5
126 | [HttpPost, ActionName ("Delete")]
127 | [ValidateAntiForgeryToken]
128 | public async Task DeleteConfirmed (int id) {
129 | var Tweet = await _context.Tweet.FindAsync (id);
130 | _context.Tweet.Remove (Tweet);
131 | await _context.SaveChangesAsync ();
132 | return RedirectToAction (nameof (Index));
133 | }
134 |
135 | private bool TweetExists (int id) {
136 | return _context.Tweet.Any (e => e.Id == id);
137 | }
138 |
139 | [ResponseCache (Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
140 | public IActionResult Error () {
141 | return View (new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
142 | }
143 |
144 | public IActionResult Privacy () {
145 | return View ();
146 | }
147 | }
148 | }
--------------------------------------------------------------------------------
/Data/ApplicationDbContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
5 | using Microsoft.EntityFrameworkCore;
6 | using Jetweet.Models;
7 |
8 | namespace Jetweet.Data {
9 | public class ApplicationDbContext : IdentityDbContext {
10 | public ApplicationDbContext (DbContextOptions options) : base (options) { }
11 |
12 | public DbSet Tweet { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Microsoft.EntityFrameworkCore.Infrastructure;
3 | using Microsoft.EntityFrameworkCore.Migrations;
4 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; //
5 | using System;
6 |
7 | namespace Jetweet.Data.Migrations {
8 | [DbContext (typeof (ApplicationDbContext))]
9 | [Migration ("00000000000000_CreateIdentitySchema")]
10 | partial class CreateIdentitySchema {
11 | protected override void BuildTargetModel (ModelBuilder modelBuilder) {
12 | #pragma warning disable 612, 618
13 | modelBuilder
14 | .HasAnnotation ("ProductVersion", "2.2.0-preview1");
15 |
16 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityRole", b => {
17 | b.Property ("Id")
18 | .ValueGeneratedOnAdd ();
19 |
20 | b.Property ("ConcurrencyStamp")
21 | .IsConcurrencyToken ();
22 |
23 | b.Property ("Name")
24 | .HasMaxLength (256);
25 |
26 | b.Property ("NormalizedName")
27 | .HasMaxLength (256);
28 |
29 | b.HasKey ("Id");
30 |
31 | b.HasIndex ("NormalizedName")
32 | .IsUnique ()
33 | .HasName ("RoleNameIndex");
34 |
35 | b.ToTable ("AspNetRoles");
36 | });
37 |
38 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => {
39 | b.Property ("Id")
40 | .ValueGeneratedOnAdd ();
41 |
42 | b.Property ("ClaimType");
43 |
44 | b.Property ("ClaimValue");
45 |
46 | b.Property ("RoleId")
47 | .IsRequired ();
48 |
49 | b.HasKey ("Id");
50 |
51 | b.HasIndex ("RoleId");
52 |
53 | b.ToTable ("AspNetRoleClaims");
54 | });
55 |
56 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUser", b => {
57 | b.Property ("Id")
58 | .ValueGeneratedOnAdd ();
59 |
60 | b.Property ("AccessFailedCount");
61 |
62 | b.Property ("ConcurrencyStamp")
63 | .IsConcurrencyToken ();
64 |
65 | b.Property ("Email")
66 | .HasMaxLength (256);
67 |
68 | b.Property ("EmailConfirmed");
69 |
70 | b.Property ("LockoutEnabled");
71 |
72 | b.Property ("LockoutEnd");
73 |
74 | b.Property ("NormalizedEmail")
75 | .HasMaxLength (256);
76 |
77 | b.Property ("NormalizedUserName")
78 | .HasMaxLength (256);
79 |
80 | b.Property ("PasswordHash");
81 |
82 | b.Property ("PhoneNumber");
83 |
84 | b.Property ("PhoneNumberConfirmed");
85 |
86 | b.Property ("SecurityStamp");
87 |
88 | b.Property ("TwoFactorEnabled");
89 |
90 | b.Property ("UserName")
91 | .HasMaxLength (256);
92 |
93 | b.HasKey ("Id");
94 |
95 | b.HasIndex ("NormalizedEmail")
96 | .HasName ("EmailIndex");
97 |
98 | b.HasIndex ("NormalizedUserName")
99 | .IsUnique ()
100 | .HasName ("UserNameIndex");
101 |
102 | b.ToTable ("AspNetUsers");
103 | });
104 |
105 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => {
106 | b.Property ("Id")
107 | .ValueGeneratedOnAdd ();
108 |
109 | b.Property ("ClaimType");
110 |
111 | b.Property ("ClaimValue");
112 |
113 | b.Property ("UserId")
114 | .IsRequired ();
115 |
116 | b.HasKey ("Id");
117 |
118 | b.HasIndex ("UserId");
119 |
120 | b.ToTable ("AspNetUserClaims");
121 | });
122 |
123 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => {
124 | b.Property ("LoginProvider")
125 | .HasMaxLength (128);
126 |
127 | b.Property ("ProviderKey")
128 | .HasMaxLength (128);
129 |
130 | b.Property ("ProviderDisplayName");
131 |
132 | b.Property ("UserId")
133 | .IsRequired ();
134 |
135 | b.HasKey ("LoginProvider", "ProviderKey");
136 |
137 | b.HasIndex ("UserId");
138 |
139 | b.ToTable ("AspNetUserLogins");
140 | });
141 |
142 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserRole", b => {
143 | b.Property ("UserId");
144 |
145 | b.Property ("RoleId");
146 |
147 | b.HasKey ("UserId", "RoleId");
148 |
149 | b.HasIndex ("RoleId");
150 |
151 | b.ToTable ("AspNetUserRoles");
152 | });
153 |
154 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserToken", b => {
155 | b.Property ("UserId");
156 |
157 | b.Property ("LoginProvider")
158 | .HasMaxLength (128);
159 |
160 | b.Property ("Name")
161 | .HasMaxLength (128);
162 |
163 | b.Property ("Value");
164 |
165 | b.HasKey ("UserId", "LoginProvider", "Name");
166 |
167 | b.ToTable ("AspNetUserTokens");
168 | });
169 |
170 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => {
171 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityRole")
172 | .WithMany ()
173 | .HasForeignKey ("RoleId")
174 | .OnDelete (DeleteBehavior.Cascade);
175 | });
176 |
177 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => {
178 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityUser")
179 | .WithMany ()
180 | .HasForeignKey ("UserId")
181 | .OnDelete (DeleteBehavior.Cascade);
182 | });
183 |
184 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => {
185 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityUser")
186 | .WithMany ()
187 | .HasForeignKey ("UserId")
188 | .OnDelete (DeleteBehavior.Cascade);
189 | });
190 |
191 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserRole", b => {
192 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityRole")
193 | .WithMany ()
194 | .HasForeignKey ("RoleId")
195 | .OnDelete (DeleteBehavior.Cascade);
196 |
197 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityUser")
198 | .WithMany ()
199 | .HasForeignKey ("UserId")
200 | .OnDelete (DeleteBehavior.Cascade);
201 | });
202 |
203 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserToken", b => {
204 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityUser")
205 | .WithMany ()
206 | .HasForeignKey ("UserId")
207 | .OnDelete (DeleteBehavior.Cascade);
208 | });
209 | #pragma warning restore 612, 618
210 | }
211 | }
212 | }
--------------------------------------------------------------------------------
/Data/Migrations/00000000000000_CreateIdentitySchema.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Infrastructure;
4 | using Microsoft.EntityFrameworkCore.Migrations;
5 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
6 |
7 | namespace Jetweet.Data.Migrations {
8 | public partial class CreateIdentitySchema : Migration {
9 | protected override void Up (MigrationBuilder migrationBuilder) {
10 | migrationBuilder.CreateTable (
11 | name: "AspNetRoles",
12 | columns : table => new {
13 | Id = table.Column (nullable: false),
14 | Name = table.Column (maxLength: 256, nullable: true),
15 | NormalizedName = table.Column (maxLength: 256, nullable: true),
16 | ConcurrencyStamp = table.Column (nullable: true)
17 | },
18 | constraints : table => { table.PrimaryKey ("PK_AspNetRoles", x => x.Id); });
19 |
20 | migrationBuilder.CreateTable (
21 | name: "AspNetUsers",
22 | columns : table => new {
23 | Id = table.Column (nullable: false),
24 | UserName = table.Column (maxLength: 256, nullable: true),
25 | NormalizedUserName = table.Column (maxLength: 256, nullable: true),
26 | Email = table.Column (maxLength: 256, nullable: true),
27 | NormalizedEmail = table.Column (maxLength: 256, nullable: true),
28 | EmailConfirmed = table.Column (nullable: false),
29 | PasswordHash = table.Column (nullable: true),
30 | SecurityStamp = table.Column (nullable: true),
31 | ConcurrencyStamp = table.Column (nullable: true),
32 | PhoneNumber = table.Column (nullable: true),
33 | PhoneNumberConfirmed = table.Column (nullable: false),
34 | TwoFactorEnabled = table.Column (nullable: false),
35 | LockoutEnd = table.Column (nullable: true),
36 | LockoutEnabled = table.Column (nullable: false),
37 | AccessFailedCount = table.Column (nullable: false)
38 | },
39 | constraints : table => { table.PrimaryKey ("PK_AspNetUsers", x => x.Id); });
40 |
41 | migrationBuilder.CreateTable (
42 | name: "AspNetRoleClaims",
43 | columns : table => new {
44 | Id = table.Column (nullable: false)
45 | .Annotation ("Sqlite:Autoincrement", true),
46 | RoleId = table.Column (nullable: false),
47 | ClaimType = table.Column (nullable: true),
48 | ClaimValue = table.Column (nullable: true)
49 | },
50 | constraints : table => {
51 | table.PrimaryKey ("PK_AspNetRoleClaims", x => x.Id);
52 | table.ForeignKey (
53 | name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
54 | column : x => x.RoleId,
55 | principalTable: "AspNetRoles",
56 | principalColumn: "Id",
57 | onDelete : ReferentialAction.Cascade);
58 | });
59 |
60 | migrationBuilder.CreateTable (
61 | name: "AspNetUserClaims",
62 | columns : table => new {
63 | Id = table.Column (nullable: false)
64 | .Annotation ("Sqlite:Autoincrement", true),
65 | UserId = table.Column (nullable: false),
66 | ClaimType = table.Column (nullable: true),
67 | ClaimValue = table.Column (nullable: true)
68 | },
69 | constraints : table => {
70 | table.PrimaryKey ("PK_AspNetUserClaims", x => x.Id);
71 | table.ForeignKey (
72 | name: "FK_AspNetUserClaims_AspNetUsers_UserId",
73 | column : x => x.UserId,
74 | principalTable: "AspNetUsers",
75 | principalColumn: "Id",
76 | onDelete : ReferentialAction.Cascade);
77 | });
78 |
79 | migrationBuilder.CreateTable (
80 | name: "AspNetUserLogins",
81 | columns : table => new {
82 | LoginProvider = table.Column (maxLength: 128, nullable: false),
83 | ProviderKey = table.Column (maxLength: 128, nullable: false),
84 | ProviderDisplayName = table.Column (nullable: true),
85 | UserId = table.Column (nullable: false)
86 | },
87 | constraints : table => {
88 | table.PrimaryKey ("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
89 | table.ForeignKey (
90 | name: "FK_AspNetUserLogins_AspNetUsers_UserId",
91 | column : x => x.UserId,
92 | principalTable: "AspNetUsers",
93 | principalColumn: "Id",
94 | onDelete : ReferentialAction.Cascade);
95 | });
96 |
97 | migrationBuilder.CreateTable (
98 | name: "AspNetUserRoles",
99 | columns : table => new {
100 | UserId = table.Column (nullable: false),
101 | RoleId = table.Column (nullable: false)
102 | },
103 | constraints : table => {
104 | table.PrimaryKey ("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
105 | table.ForeignKey (
106 | name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
107 | column : x => x.RoleId,
108 | principalTable: "AspNetRoles",
109 | principalColumn: "Id",
110 | onDelete : ReferentialAction.Cascade);
111 | table.ForeignKey (
112 | name: "FK_AspNetUserRoles_AspNetUsers_UserId",
113 | column : x => x.UserId,
114 | principalTable: "AspNetUsers",
115 | principalColumn: "Id",
116 | onDelete : ReferentialAction.Cascade);
117 | });
118 |
119 | migrationBuilder.CreateTable (
120 | name: "AspNetUserTokens",
121 | columns : table => new {
122 | UserId = table.Column (nullable: false),
123 | LoginProvider = table.Column (maxLength: 128, nullable: false),
124 | Name = table.Column (maxLength: 128, nullable: false),
125 | Value = table.Column (nullable: true)
126 | },
127 | constraints : table => {
128 | table.PrimaryKey ("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
129 | table.ForeignKey (
130 | name: "FK_AspNetUserTokens_AspNetUsers_UserId",
131 | column : x => x.UserId,
132 | principalTable: "AspNetUsers",
133 | principalColumn: "Id",
134 | onDelete : ReferentialAction.Cascade);
135 | });
136 |
137 | migrationBuilder.CreateIndex (
138 | name: "IX_AspNetRoleClaims_RoleId",
139 | table: "AspNetRoleClaims",
140 | column: "RoleId");
141 |
142 | migrationBuilder.CreateIndex (
143 | name: "RoleNameIndex",
144 | table: "AspNetRoles",
145 | column: "NormalizedName",
146 | unique : true);
147 |
148 | migrationBuilder.CreateIndex (
149 | name: "IX_AspNetUserClaims_UserId",
150 | table: "AspNetUserClaims",
151 | column: "UserId");
152 |
153 | migrationBuilder.CreateIndex (
154 | name: "IX_AspNetUserLogins_UserId",
155 | table: "AspNetUserLogins",
156 | column: "UserId");
157 |
158 | migrationBuilder.CreateIndex (
159 | name: "IX_AspNetUserRoles_RoleId",
160 | table: "AspNetUserRoles",
161 | column: "RoleId");
162 |
163 | migrationBuilder.CreateIndex (
164 | name: "EmailIndex",
165 | table: "AspNetUsers",
166 | column: "NormalizedEmail");
167 |
168 | migrationBuilder.CreateIndex (
169 | name: "UserNameIndex",
170 | table: "AspNetUsers",
171 | column: "NormalizedUserName",
172 | unique : true);
173 | }
174 |
175 | protected override void Down (MigrationBuilder migrationBuilder) {
176 | migrationBuilder.DropTable (
177 | name: "AspNetRoleClaims");
178 |
179 | migrationBuilder.DropTable (
180 | name: "AspNetUserClaims");
181 |
182 | migrationBuilder.DropTable (
183 | name: "AspNetUserLogins");
184 |
185 | migrationBuilder.DropTable (
186 | name: "AspNetUserRoles");
187 |
188 | migrationBuilder.DropTable (
189 | name: "AspNetUserTokens");
190 |
191 | migrationBuilder.DropTable (
192 | name: "AspNetRoles");
193 |
194 | migrationBuilder.DropTable (
195 | name: "AspNetUsers");
196 | }
197 | }
198 | }
--------------------------------------------------------------------------------
/Data/Migrations/20180824202814_InitialCreate.Designer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Infrastructure;
4 | using Microsoft.EntityFrameworkCore.Migrations;
5 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; //
6 |
7 | namespace Jetweet.Data.Migrations {
8 | [DbContext (typeof (ApplicationDbContext))]
9 | [Migration ("20180824202814_InitialCreate")]
10 | partial class InitialCreate {
11 | protected override void BuildTargetModel (ModelBuilder modelBuilder) {
12 | #pragma warning disable 612, 618
13 | modelBuilder
14 | .HasAnnotation ("ProductVersion", "2.2.0-preview1-35029");
15 |
16 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityRole", b => {
17 | b.Property ("Id")
18 | .ValueGeneratedOnAdd ();
19 |
20 | b.Property ("ConcurrencyStamp")
21 | .IsConcurrencyToken ();
22 |
23 | b.Property ("Name")
24 | .HasMaxLength (256);
25 |
26 | b.Property ("NormalizedName")
27 | .HasMaxLength (256);
28 |
29 | b.HasKey ("Id");
30 |
31 | b.HasIndex ("NormalizedName")
32 | .IsUnique ()
33 | .HasName ("RoleNameIndex");
34 |
35 | b.ToTable ("AspNetRoles");
36 | });
37 |
38 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => {
39 | b.Property ("Id")
40 | .ValueGeneratedOnAdd ();
41 |
42 | b.Property ("ClaimType");
43 |
44 | b.Property ("ClaimValue");
45 |
46 | b.Property ("RoleId")
47 | .IsRequired ();
48 |
49 | b.HasKey ("Id");
50 |
51 | b.HasIndex ("RoleId");
52 |
53 | b.ToTable ("AspNetRoleClaims");
54 | });
55 |
56 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUser", b => {
57 | b.Property ("Id")
58 | .ValueGeneratedOnAdd ();
59 |
60 | b.Property ("AccessFailedCount");
61 |
62 | b.Property ("ConcurrencyStamp")
63 | .IsConcurrencyToken ();
64 |
65 | b.Property ("Email")
66 | .HasMaxLength (256);
67 |
68 | b.Property ("EmailConfirmed");
69 |
70 | b.Property ("LockoutEnabled");
71 |
72 | b.Property ("LockoutEnd");
73 |
74 | b.Property ("NormalizedEmail")
75 | .HasMaxLength (256);
76 |
77 | b.Property ("NormalizedUserName")
78 | .HasMaxLength (256);
79 |
80 | b.Property ("PasswordHash");
81 |
82 | b.Property ("PhoneNumber");
83 |
84 | b.Property ("PhoneNumberConfirmed");
85 |
86 | b.Property ("SecurityStamp");
87 |
88 | b.Property ("TwoFactorEnabled");
89 |
90 | b.Property ("UserName")
91 | .HasMaxLength (256);
92 |
93 | b.HasKey ("Id");
94 |
95 | b.HasIndex ("NormalizedEmail")
96 | .HasName ("EmailIndex");
97 |
98 | b.HasIndex ("NormalizedUserName")
99 | .IsUnique ()
100 | .HasName ("UserNameIndex");
101 |
102 | b.ToTable ("AspNetUsers");
103 | });
104 |
105 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => {
106 | b.Property ("Id")
107 | .ValueGeneratedOnAdd ();
108 |
109 | b.Property ("ClaimType");
110 |
111 | b.Property ("ClaimValue");
112 |
113 | b.Property ("UserId")
114 | .IsRequired ();
115 |
116 | b.HasKey ("Id");
117 |
118 | b.HasIndex ("UserId");
119 |
120 | b.ToTable ("AspNetUserClaims");
121 | });
122 |
123 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => {
124 | b.Property ("LoginProvider")
125 | .HasMaxLength (128);
126 |
127 | b.Property ("ProviderKey")
128 | .HasMaxLength (128);
129 |
130 | b.Property ("ProviderDisplayName");
131 |
132 | b.Property ("UserId")
133 | .IsRequired ();
134 |
135 | b.HasKey ("LoginProvider", "ProviderKey");
136 |
137 | b.HasIndex ("UserId");
138 |
139 | b.ToTable ("AspNetUserLogins");
140 | });
141 |
142 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserRole", b => {
143 | b.Property ("UserId");
144 |
145 | b.Property ("RoleId");
146 |
147 | b.HasKey ("UserId", "RoleId");
148 |
149 | b.HasIndex ("RoleId");
150 |
151 | b.ToTable ("AspNetUserRoles");
152 | });
153 |
154 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserToken", b => {
155 | b.Property ("UserId");
156 |
157 | b.Property ("LoginProvider")
158 | .HasMaxLength (128);
159 |
160 | b.Property ("Name")
161 | .HasMaxLength (128);
162 |
163 | b.Property ("Value");
164 |
165 | b.HasKey ("UserId", "LoginProvider", "Name");
166 |
167 | b.ToTable ("AspNetUserTokens");
168 | });
169 |
170 | modelBuilder.Entity ("Jetweet.Models.Tweet", b => {
171 | b.Property ("Id")
172 | .ValueGeneratedOnAdd ();
173 |
174 | b.Property ("Text")
175 | .IsRequired ();
176 |
177 | b.Property ("ImageUrl")
178 | .IsRequired ();
179 |
180 | b.HasKey ("Id");
181 |
182 | b.ToTable ("Employee");
183 | });
184 |
185 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => {
186 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityRole")
187 | .WithMany ()
188 | .HasForeignKey ("RoleId")
189 | .OnDelete (DeleteBehavior.Cascade);
190 | });
191 |
192 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => {
193 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityUser")
194 | .WithMany ()
195 | .HasForeignKey ("UserId")
196 | .OnDelete (DeleteBehavior.Cascade);
197 | });
198 |
199 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => {
200 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityUser")
201 | .WithMany ()
202 | .HasForeignKey ("UserId")
203 | .OnDelete (DeleteBehavior.Cascade);
204 | });
205 |
206 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserRole", b => {
207 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityRole")
208 | .WithMany ()
209 | .HasForeignKey ("RoleId")
210 | .OnDelete (DeleteBehavior.Cascade);
211 |
212 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityUser")
213 | .WithMany ()
214 | .HasForeignKey ("UserId")
215 | .OnDelete (DeleteBehavior.Cascade);
216 | });
217 |
218 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserToken", b => {
219 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityUser")
220 | .WithMany ()
221 | .HasForeignKey ("UserId")
222 | .OnDelete (DeleteBehavior.Cascade);
223 | });
224 | #pragma warning restore 612, 618
225 | }
226 | }
227 | }
--------------------------------------------------------------------------------
/Data/Migrations/20180824202814_InitialCreate.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Microsoft.EntityFrameworkCore.Infrastructure;
3 | using Microsoft.EntityFrameworkCore.Migrations;
4 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
5 |
6 | namespace Jetweet.Data.Migrations {
7 | public partial class InitialCreate : Migration {
8 | protected override void Up (MigrationBuilder migrationBuilder) {
9 | migrationBuilder.CreateTable (
10 | name: "Tweet",
11 | columns : table => new {
12 | Id = table.Column (nullable: false)
13 | .Annotation ("Sqlite:Autoincrement", true),
14 | ImageUrl = table.Column (nullable: false),
15 | Text = table.Column (nullable: false)
16 | },
17 | constraints : table => { table.PrimaryKey ("PK_Tweet", x => x.Id); });
18 | }
19 |
20 | protected override void Down (MigrationBuilder migrationBuilder) {
21 | migrationBuilder.DropTable (
22 | name: "Tweet");
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/Data/Migrations/20180827150655_test.Designer.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System;
3 | using Microsoft.EntityFrameworkCore;
4 | using Microsoft.EntityFrameworkCore.Infrastructure;
5 | using Microsoft.EntityFrameworkCore.Migrations;
6 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7 |
8 | namespace Jetweet.Data.Migrations {
9 | [DbContext (typeof (ApplicationDbContext))]
10 | [Migration ("20180827150655_test")]
11 | partial class test {
12 | protected override void BuildTargetModel (ModelBuilder modelBuilder) {
13 | #pragma warning disable 612, 618
14 | modelBuilder
15 | .HasAnnotation ("ProductVersion", "2.2.0-preview1-35029");
16 |
17 | modelBuilder.Entity ("Jetweet.Models.Tweet", b => {
18 | b.Property ("Id")
19 | .ValueGeneratedOnAdd ();
20 |
21 | b.Property ("Text")
22 | .IsRequired ();
23 |
24 | b.Property ("ImageUrl")
25 | .IsRequired ();
26 |
27 | b.HasKey ("Id");
28 |
29 | b.ToTable ("Tweet");
30 | });
31 |
32 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityRole", b => {
33 | b.Property ("Id")
34 | .ValueGeneratedOnAdd ();
35 |
36 | b.Property ("ConcurrencyStamp")
37 | .IsConcurrencyToken ();
38 |
39 | b.Property ("Name")
40 | .HasMaxLength (256);
41 |
42 | b.Property ("NormalizedName")
43 | .HasMaxLength (256);
44 |
45 | b.HasKey ("Id");
46 |
47 | b.HasIndex ("NormalizedName")
48 | .IsUnique ()
49 | .HasName ("RoleNameIndex");
50 |
51 | b.ToTable ("AspNetRoles");
52 | });
53 |
54 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => {
55 | b.Property ("Id")
56 | .ValueGeneratedOnAdd ();
57 |
58 | b.Property ("ClaimType");
59 |
60 | b.Property ("ClaimValue");
61 |
62 | b.Property ("RoleId")
63 | .IsRequired ();
64 |
65 | b.HasKey ("Id");
66 |
67 | b.HasIndex ("RoleId");
68 |
69 | b.ToTable ("AspNetRoleClaims");
70 | });
71 |
72 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUser", b => {
73 | b.Property ("Id")
74 | .ValueGeneratedOnAdd ();
75 |
76 | b.Property ("AccessFailedCount");
77 |
78 | b.Property ("ConcurrencyStamp")
79 | .IsConcurrencyToken ();
80 |
81 | b.Property ("Email")
82 | .HasMaxLength (256);
83 |
84 | b.Property ("EmailConfirmed");
85 |
86 | b.Property ("LockoutEnabled");
87 |
88 | b.Property ("LockoutEnd");
89 |
90 | b.Property ("NormalizedEmail")
91 | .HasMaxLength (256);
92 |
93 | b.Property ("NormalizedUserName")
94 | .HasMaxLength (256);
95 |
96 | b.Property ("PasswordHash");
97 |
98 | b.Property ("PhoneNumber");
99 |
100 | b.Property ("PhoneNumberConfirmed");
101 |
102 | b.Property ("SecurityStamp");
103 |
104 | b.Property ("TwoFactorEnabled");
105 |
106 | b.Property ("UserName")
107 | .HasMaxLength (256);
108 |
109 | b.HasKey ("Id");
110 |
111 | b.HasIndex ("NormalizedEmail")
112 | .HasName ("EmailIndex");
113 |
114 | b.HasIndex ("NormalizedUserName")
115 | .IsUnique ()
116 | .HasName ("UserNameIndex");
117 |
118 | b.ToTable ("AspNetUsers");
119 | });
120 |
121 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => {
122 | b.Property ("Id")
123 | .ValueGeneratedOnAdd ();
124 |
125 | b.Property ("ClaimType");
126 |
127 | b.Property ("ClaimValue");
128 |
129 | b.Property ("UserId")
130 | .IsRequired ();
131 |
132 | b.HasKey ("Id");
133 |
134 | b.HasIndex ("UserId");
135 |
136 | b.ToTable ("AspNetUserClaims");
137 | });
138 |
139 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => {
140 | b.Property ("LoginProvider")
141 | .HasMaxLength (128);
142 |
143 | b.Property ("ProviderKey")
144 | .HasMaxLength (128);
145 |
146 | b.Property ("ProviderDisplayName");
147 |
148 | b.Property ("UserId")
149 | .IsRequired ();
150 |
151 | b.HasKey ("LoginProvider", "ProviderKey");
152 |
153 | b.HasIndex ("UserId");
154 |
155 | b.ToTable ("AspNetUserLogins");
156 | });
157 |
158 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserRole", b => {
159 | b.Property ("UserId");
160 |
161 | b.Property ("RoleId");
162 |
163 | b.HasKey ("UserId", "RoleId");
164 |
165 | b.HasIndex ("RoleId");
166 |
167 | b.ToTable ("AspNetUserRoles");
168 | });
169 |
170 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserToken", b => {
171 | b.Property ("UserId");
172 |
173 | b.Property ("LoginProvider")
174 | .HasMaxLength (128);
175 |
176 | b.Property ("Name")
177 | .HasMaxLength (128);
178 |
179 | b.Property ("Value");
180 |
181 | b.HasKey ("UserId", "LoginProvider", "Name");
182 |
183 | b.ToTable ("AspNetUserTokens");
184 | });
185 |
186 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => {
187 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityRole")
188 | .WithMany ()
189 | .HasForeignKey ("RoleId")
190 | .OnDelete (DeleteBehavior.Cascade);
191 | });
192 |
193 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => {
194 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityUser")
195 | .WithMany ()
196 | .HasForeignKey ("UserId")
197 | .OnDelete (DeleteBehavior.Cascade);
198 | });
199 |
200 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => {
201 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityUser")
202 | .WithMany ()
203 | .HasForeignKey ("UserId")
204 | .OnDelete (DeleteBehavior.Cascade);
205 | });
206 |
207 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserRole", b => {
208 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityRole")
209 | .WithMany ()
210 | .HasForeignKey ("RoleId")
211 | .OnDelete (DeleteBehavior.Cascade);
212 |
213 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityUser")
214 | .WithMany ()
215 | .HasForeignKey ("UserId")
216 | .OnDelete (DeleteBehavior.Cascade);
217 | });
218 |
219 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserToken", b => {
220 | b.HasOne ("Microsoft.AspNetCore.Identity.IdentityUser")
221 | .WithMany ()
222 | .HasForeignKey ("UserId")
223 | .OnDelete (DeleteBehavior.Cascade);
224 | });
225 | #pragma warning restore 612, 618
226 | }
227 | }
228 | }
--------------------------------------------------------------------------------
/Data/Migrations/20180827150655_test.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Microsoft.EntityFrameworkCore.Infrastructure;
3 | using Microsoft.EntityFrameworkCore.Migrations;
4 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
5 |
6 | namespace Jetweet.Data.Migrations {
7 | public partial class test : Migration {
8 | protected override void Up (MigrationBuilder migrationBuilder) { }
9 |
10 | protected override void Down (MigrationBuilder migrationBuilder) { }
11 | }
12 | }
--------------------------------------------------------------------------------
/Data/Migrations/20180827165512_ChangetoTweet.Designer.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System;
3 | using Microsoft.EntityFrameworkCore;
4 | using Microsoft.EntityFrameworkCore.Infrastructure;
5 | using Microsoft.EntityFrameworkCore.Migrations;
6 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7 |
8 | namespace Jetweet.Data.Migrations {
9 | [DbContext (typeof (ApplicationDbContext))]
10 | [Migration ("20180827165512_ChangetoTweet")]
11 | partial class ChangetoTweet {
12 | protected override void BuildTargetModel (ModelBuilder modelBuilder) {
13 | #pragma warning disable 612, 618
14 | modelBuilder
15 | .HasAnnotation ("ProductVersion", "2.2.0-preview1-35029");
16 |
17 | modelBuilder.Entity ("Jetweet.Models.Tweet", b => {
18 | b.Property ("Id")
19 | .ValueGeneratedOnAdd ();
20 |
21 | b.Property ("Text")
22 | .IsRequired ();
23 |
24 | b.Property ("ImageUrl")
25 | .IsRequired ();
26 |
27 | b.HasKey ("Id");
28 |
29 | b.ToTable ("Tweet");
30 | });
31 |
32 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityRole", b => {
33 | b.Property ("Id")
34 | .ValueGeneratedOnAdd ();
35 |
36 | b.Property ("ConcurrencyStamp")
37 | .IsConcurrencyToken ();
38 |
39 | b.Property ("Name")
40 | .HasMaxLength (256);
41 |
42 | b.Property ("NormalizedName")
43 | .HasMaxLength (256);
44 |
45 | b.HasKey ("Id");
46 |
47 | b.HasIndex ("NormalizedName")
48 | .IsUnique ()
49 | .HasName ("RoleNameIndex");
50 |
51 | b.ToTable ("AspNetRoles");
52 | });
53 |
54 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => {
55 | b.Property ("Id")
56 | .ValueGeneratedOnAdd ();
57 |
58 | b.Property ("ClaimType");
59 |
60 | b.Property ("ClaimValue");
61 |
62 | b.Property ("RoleId")
63 | .IsRequired ();
64 |
65 | b.HasKey ("Id");
66 |
67 | b.HasIndex ("RoleId");
68 |
69 | b.ToTable ("AspNetRoleClaims");
70 | });
71 |
72 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUser", b => {
73 | b.Property ("Id")
74 | .ValueGeneratedOnAdd ();
75 |
76 | b.Property ("AccessFailedCount");
77 |
78 | b.Property ("ConcurrencyStamp")
79 | .IsConcurrencyToken ();
80 |
81 | b.Property ("Email")
82 | .HasMaxLength (256);
83 |
84 | b.Property ("EmailConfirmed");
85 |
86 | b.Property ("LockoutEnabled");
87 |
88 | b.Property ("LockoutEnd");
89 |
90 | b.Property ("NormalizedEmail")
91 | .HasMaxLength (256);
92 |
93 | b.Property ("NormalizedUserName")
94 | .HasMaxLength (256);
95 |
96 | b.Property ("PasswordHash");
97 |
98 | b.Property ("PhoneNumber");
99 |
100 | b.Property ("PhoneNumberConfirmed");
101 |
102 | b.Property ("SecurityStamp");
103 |
104 | b.Property ("TwoFactorEnabled");
105 |
106 | b.Property ("UserName")
107 | .HasMaxLength (256);
108 |
109 | b.HasKey ("Id");
110 |
111 | b.HasIndex ("NormalizedEmail")
112 | .HasName ("EmailIndex");
113 |
114 | b.HasIndex ("NormalizedUserName")
115 | .IsUnique ()
116 | .HasName ("UserNameIndex");
117 |
118 | b.ToTable ("AspNetUsers");
119 | });
120 |
121 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => {
122 | b.Property ("Id")
123 | .ValueGeneratedOnAdd ();
124 |
125 | b.Property ("ClaimType");
126 |
127 | b.Property ("ClaimValue");
128 |
129 | b.Property ("UserId")
130 | .IsRequired ();
131 |
132 | b.HasKey ("Id");
133 |
134 | b.HasIndex ("UserId");
135 |
136 | b.ToTable ("AspNetUserClaims");
137 | });
138 |
139 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => {
140 | b.Property ("LoginProvider")
141 | .HasMaxLength (128);
142 |
143 | b.Property ("ProviderKey")
144 | .HasMaxLength (128);
145 |
146 | b.Property ("ProviderDisplayName");
147 |
148 | b.Property ("UserId")
149 | .IsRequired ();
150 |
151 | b.HasKey ("LoginProvider", "ProviderKey");
152 |
153 | b.HasIndex ("UserId");
154 |
155 | b.ToTable ("AspNetUserLogins");
156 | });
157 |
158 | modelBuilder.Entity ("Microsoft.AspNetCore.Identity.IdentityUserRole