This component demonstrates fetching data from the server.
4 |
5 | (baseUrl + 'weatherforecast').subscribe(result => {
13 | this.forecasts = result;
14 | }, error => console.error(error));
15 | }
16 | }
17 |
18 | interface WeatherForecast {
19 | date: string;
20 | temperatureC: number;
21 | temperatureF: number;
22 | summary: string;
23 | }
24 |
--------------------------------------------------------------------------------
/ClientApp/src/app/home/home.component.html:
--------------------------------------------------------------------------------
1 | Hello, world!
2 | Welcome to your new single-page application, built with:
3 |
8 | To help you get started, we've also set up:
9 |
10 | Client-side navigation . For example, click Counter then Back to return here.
11 | Angular CLI integration . In development mode, there's no need to run ng serve
. It runs in the background automatically, so your client-side resources are dynamically built on demand and the page refreshes when you modify any file.
12 | Efficient production builds . In production mode, development-time features are disabled, and your dotnet publish
configuration automatically invokes ng build
to produce minified, ahead-of-time compiled JavaScript files.
13 |
14 | The ClientApp
subdirectory is a standard Angular CLI application. If you open a command prompt in that directory, you can run any ng
command (e.g., ng test
), or use npm
to install extra packages into it.
15 |
--------------------------------------------------------------------------------
/ClientApp/src/app/home/home.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-home',
5 | templateUrl: './home.component.html',
6 | })
7 | export class HomeComponent {
8 | }
9 |
--------------------------------------------------------------------------------
/ClientApp/src/app/nav-menu/nav-menu.component.css:
--------------------------------------------------------------------------------
1 | a.navbar-brand {
2 | white-space: normal;
3 | text-align: center;
4 | word-break: break-all;
5 | }
6 |
7 | html {
8 | font-size: 14px;
9 | }
10 | @media (min-width: 768px) {
11 | html {
12 | font-size: 16px;
13 | }
14 | }
15 |
16 | .box-shadow {
17 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
18 | }
19 |
--------------------------------------------------------------------------------
/ClientApp/src/app/nav-menu/nav-menu.component.html:
--------------------------------------------------------------------------------
1 |
46 |
--------------------------------------------------------------------------------
/ClientApp/src/app/nav-menu/nav-menu.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-nav-menu',
5 | templateUrl: './nav-menu.component.html',
6 | styleUrls: ['./nav-menu.component.css']
7 | })
8 | export class NavMenuComponent {
9 | isExpanded = false;
10 |
11 | collapse() {
12 | this.isExpanded = false;
13 | }
14 |
15 | toggle() {
16 | this.isExpanded = !this.isExpanded;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/ClientApp/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nirzaf/ASPWebAppWithDocker/1e5f4526b3424be67a198ea9f3a4f63549a13c30/ClientApp/src/assets/.gitkeep
--------------------------------------------------------------------------------
/ClientApp/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/ClientApp/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/ClientApp/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ASPWebApp
6 |
7 |
8 |
9 |
10 |
11 |
12 | Loading...
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ClientApp/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | export function getBaseUrl() {
8 | return document.getElementsByTagName('base')[0].href;
9 | }
10 |
11 | const providers = [
12 | { provide: 'BASE_URL', useFactory: getBaseUrl, deps: [] }
13 | ];
14 |
15 | if (environment.production) {
16 | enableProdMode();
17 | }
18 |
19 | platformBrowserDynamic(providers).bootstrapModule(AppModule)
20 | .catch(err => console.log(err));
21 |
--------------------------------------------------------------------------------
/ClientApp/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /**
22 | * IE11 requires the following for NgClass support on SVG elements
23 | */
24 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
25 |
26 | /**
27 | * Web Animations `@angular/platform-browser/animations`
28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
30 | */
31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
32 |
33 | /**
34 | * By default, zone.js will patch all possible macroTask and DomEvents
35 | * user can disable parts of macroTask/DomEvents patch by setting following flags
36 | * because those flags need to be set before `zone.js` being loaded, and webpack
37 | * will put import in the top of bundle, so user need to create a separate file
38 | * in this directory (for example: zone-flags.ts), and put the following flags
39 | * into that file, and then add the following code before importing zone.js.
40 | * import './zone-flags';
41 | *
42 | * The flags allowed in zone-flags.ts are listed here.
43 | *
44 | * The following flags will work for all browsers.
45 | *
46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
49 | *
50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
52 | *
53 | * (window as any).__Zone_enable_cross_context_check = true;
54 | *
55 | */
56 |
57 | /***************************************************************************************************
58 | * Zone JS is required by default for Angular itself.
59 | */
60 | import 'zone.js'; // Included with Angular CLI.
61 |
62 |
63 | /***************************************************************************************************
64 | * APPLICATION IMPORTS
65 | */
66 |
--------------------------------------------------------------------------------
/ClientApp/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
3 | /* Provide sufficient contrast against white background */
4 | a {
5 | color: #0366d6;
6 | }
7 |
8 | code {
9 | color: #e01a76;
10 | }
11 |
12 | .btn-primary {
13 | color: #fff;
14 | background-color: #1b6ec2;
15 | border-color: #1861ac;
16 | }
17 |
--------------------------------------------------------------------------------
/ClientApp/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | keys(): string[];
13 | (id: string): T;
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting()
21 | );
22 | // Then we find all the tests.
23 | const context = require.context('./', true, /\.spec\.ts$/);
24 | // And load the modules.
25 | context.keys().map(context);
26 |
--------------------------------------------------------------------------------
/ClientApp/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/app",
6 | "types": []
7 | },
8 | "files": [
9 | "src/main.ts",
10 | "src/polyfills.ts"
11 | ],
12 | "include": [
13 | "src/**/*.d.ts"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/ClientApp/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "forceConsistentCasingInFileNames": true,
7 | "strict": true,
8 | "noImplicitReturns": true,
9 | "noFallthroughCasesInSwitch": true,
10 | "sourceMap": true,
11 | "declaration": false,
12 | "downlevelIteration": true,
13 | "experimentalDecorators": true,
14 | "moduleResolution": "node",
15 | "importHelpers": true,
16 | "target": "es2017",
17 | "module": "es2020",
18 | "lib": [
19 | "es2018",
20 | "dom"
21 | ]
22 | },
23 | "angularCompilerOptions": {
24 | "enableI18nLegacyMessageIdFormat": false,
25 | "strictInjectionParameters": true,
26 | "strictInputAccessModifiers": true,
27 | "strictTemplates": true
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ClientApp/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/spec",
6 | "types": [
7 | "jasmine",
8 | "node"
9 | ]
10 | },
11 | "files": [
12 | "src/test.ts",
13 | "src/polyfills.ts"
14 | ],
15 | "include": [
16 | "src/**/*.spec.ts",
17 | "src/**/*.d.ts"
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/Controllers/OidcConfigurationController.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.ApiAuthorization.IdentityServer;
2 | using Microsoft.AspNetCore.Mvc;
3 |
4 | namespace ASPWebApp.Controllers;
5 |
6 | public class OidcConfigurationController : Controller
7 | {
8 | private readonly ILogger _logger;
9 |
10 | public OidcConfigurationController(
11 | IClientRequestParametersProvider clientRequestParametersProvider,
12 | ILogger logger)
13 | {
14 | ClientRequestParametersProvider = clientRequestParametersProvider;
15 | _logger = logger;
16 | }
17 |
18 | public IClientRequestParametersProvider ClientRequestParametersProvider { get; }
19 |
20 | [HttpGet("_configuration/{clientId}")]
21 | public IActionResult GetClientRequestParameters([FromRoute] string clientId)
22 | {
23 | var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId);
24 | return Ok(parameters);
25 | }
26 | }
--------------------------------------------------------------------------------
/Controllers/WeatherForecastController.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Authorization;
2 | using Microsoft.AspNetCore.Mvc;
3 |
4 | namespace ASPWebApp.Controllers;
5 |
6 | [Authorize]
7 | [ApiController]
8 | [Route("[controller]")]
9 | public class WeatherForecastController : ControllerBase
10 | {
11 | private static readonly string[] Summaries = new[]
12 | {
13 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
14 | };
15 |
16 | private readonly ILogger _logger;
17 |
18 | public WeatherForecastController(ILogger logger)
19 | {
20 | _logger = logger;
21 | }
22 |
23 | [HttpGet]
24 | public IEnumerable Get()
25 | {
26 | return Enumerable.Range(1, 5).Select(index => new WeatherForecast
27 | {
28 | Date = DateTime.Now.AddDays(index),
29 | TemperatureC = Random.Shared.Next(-20, 55),
30 | Summary = Summaries[Random.Shared.Next(Summaries.Length)]
31 | })
32 | .ToArray();
33 | }
34 | }
--------------------------------------------------------------------------------
/Data/ApplicationDbContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.ApiAuthorization.IdentityServer;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.Extensions.Options;
4 | using Duende.IdentityServer.EntityFramework.Options;
5 | using ASPWebApp.Models;
6 |
7 | namespace ASPWebApp.Data;
8 |
9 | public class ApplicationDbContext : ApiAuthorizationDbContext
10 | {
11 | public ApplicationDbContext(DbContextOptions options, IOptions operationalStoreOptions)
12 | : base(options, operationalStoreOptions)
13 | {
14 | }
15 | }
--------------------------------------------------------------------------------
/Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs:
--------------------------------------------------------------------------------
1 | //
2 |
3 | using System;
4 | using ASPWebApp.Data;
5 | using Microsoft.EntityFrameworkCore;
6 | using Microsoft.EntityFrameworkCore.Infrastructure;
7 | using Microsoft.EntityFrameworkCore.Migrations;
8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
9 |
10 | namespace ASPWebApp.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 | #pragma warning disable 612, 618
19 | modelBuilder
20 | .HasAnnotation("ProductVersion", "5.0.0-rc.1.20417.2");
21 |
22 | modelBuilder.Entity("ASPWebApp.Models.ApplicationUser", b =>
23 | {
24 | b.Property("Id")
25 | .HasColumnType("TEXT");
26 |
27 | b.Property("AccessFailedCount")
28 | .HasColumnType("INTEGER");
29 |
30 | b.Property("ConcurrencyStamp")
31 | .IsConcurrencyToken()
32 | .HasColumnType("TEXT");
33 |
34 | b.Property("Email")
35 | .HasMaxLength(256)
36 | .HasColumnType("TEXT");
37 |
38 | b.Property("EmailConfirmed")
39 | .HasColumnType("INTEGER");
40 |
41 | b.Property("LockoutEnabled")
42 | .HasColumnType("INTEGER");
43 |
44 | b.Property("LockoutEnd")
45 | .HasColumnType("TEXT");
46 |
47 | b.Property("NormalizedEmail")
48 | .HasMaxLength(256)
49 | .HasColumnType("TEXT");
50 |
51 | b.Property("NormalizedUserName")
52 | .HasMaxLength(256)
53 | .HasColumnType("TEXT");
54 |
55 | b.Property("PasswordHash")
56 | .HasColumnType("TEXT");
57 |
58 | b.Property("PhoneNumber")
59 | .HasColumnType("TEXT");
60 |
61 | b.Property("PhoneNumberConfirmed")
62 | .HasColumnType("INTEGER");
63 |
64 | b.Property("SecurityStamp")
65 | .HasColumnType("TEXT");
66 |
67 | b.Property("TwoFactorEnabled")
68 | .HasColumnType("INTEGER");
69 |
70 | b.Property("UserName")
71 | .HasMaxLength(256)
72 | .HasColumnType("TEXT");
73 |
74 | b.HasKey("Id");
75 |
76 | b.HasIndex("NormalizedEmail")
77 | .HasDatabaseName("EmailIndex");
78 |
79 | b.HasIndex("NormalizedUserName")
80 | .IsUnique()
81 | .HasDatabaseName("UserNameIndex");
82 |
83 | b.ToTable("AspNetUsers");
84 | });
85 |
86 | modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b =>
87 | {
88 | b.Property("UserCode")
89 | .HasMaxLength(200)
90 | .HasColumnType("TEXT");
91 |
92 | b.Property("ClientId")
93 | .IsRequired()
94 | .HasMaxLength(200)
95 | .HasColumnType("TEXT");
96 |
97 | b.Property("CreationTime")
98 | .HasColumnType("TEXT");
99 |
100 | b.Property("Data")
101 | .IsRequired()
102 | .HasMaxLength(52420)
103 | .HasColumnType("TEXT");
104 |
105 | b.Property("Description")
106 | .HasMaxLength(200)
107 | .HasColumnType("TEXT");
108 |
109 | b.Property("DeviceCode")
110 | .IsRequired()
111 | .HasMaxLength(200)
112 | .HasColumnType("TEXT");
113 |
114 | b.Property("Expiration")
115 | .IsRequired()
116 | .HasColumnType("TEXT");
117 |
118 | b.Property("SessionId")
119 | .HasMaxLength(100)
120 | .HasColumnType("TEXT");
121 |
122 | b.Property("SubjectId")
123 | .HasMaxLength(200)
124 | .HasColumnType("TEXT");
125 |
126 | b.HasKey("UserCode");
127 |
128 | b.HasIndex("DeviceCode")
129 | .IsUnique();
130 |
131 | b.HasIndex("Expiration");
132 |
133 | b.ToTable("DeviceCodes");
134 | });
135 |
136 | modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b =>
137 | {
138 | b.Property("Id")
139 | .HasColumnType("TEXT");
140 |
141 | b.Property("Algorithm")
142 | .IsRequired()
143 | .HasMaxLength(100)
144 | .HasColumnType("TEXT");
145 |
146 | b.Property("Created")
147 | .HasColumnType("TEXT");
148 |
149 | b.Property("Data")
150 | .IsRequired()
151 | .HasMaxLength(52420)
152 | .HasColumnType("TEXT");
153 |
154 | b.Property("DataProtected")
155 | .HasColumnType("INTEGER");
156 |
157 | b.Property("IsX509Certificate")
158 | .HasColumnType("INTEGER");
159 |
160 | b.Property("Use")
161 | .HasMaxLength(450)
162 | .HasColumnType("TEXT");
163 |
164 | b.Property("Version")
165 | .HasColumnType("INTEGER");
166 |
167 | b.HasKey("Id");
168 |
169 | b.HasIndex("Use");
170 |
171 | b.ToTable("Keys");
172 | });
173 |
174 | modelBuilder.Entity("Duende.EntityFramework.Entities.PersistedGrant", b =>
175 | {
176 | b.Property("Key")
177 | .HasMaxLength(200)
178 | .HasColumnType("TEXT");
179 |
180 | b.Property("ClientId")
181 | .IsRequired()
182 | .HasMaxLength(200)
183 | .HasColumnType("TEXT");
184 |
185 | b.Property("ConsumedTime")
186 | .HasColumnType("TEXT");
187 |
188 | b.Property("CreationTime")
189 | .HasColumnType("TEXT");
190 |
191 | b.Property("Data")
192 | .IsRequired()
193 | .HasMaxLength(52420)
194 | .HasColumnType("TEXT");
195 |
196 | b.Property("Description")
197 | .HasMaxLength(200)
198 | .HasColumnType("TEXT");
199 |
200 | b.Property("Expiration")
201 | .HasColumnType("TEXT");
202 |
203 | b.Property("SessionId")
204 | .HasMaxLength(100)
205 | .HasColumnType("TEXT");
206 |
207 | b.Property("SubjectId")
208 | .HasMaxLength(200)
209 | .HasColumnType("TEXT");
210 |
211 | b.Property("Type")
212 | .IsRequired()
213 | .HasMaxLength(50)
214 | .HasColumnType("TEXT");
215 |
216 | b.HasKey("Key");
217 |
218 | b.HasIndex("ConsumedTime");
219 |
220 | b.HasIndex("Expiration");
221 |
222 | b.HasIndex("SubjectId", "ClientId", "Type");
223 |
224 | b.HasIndex("SubjectId", "SessionId", "Type");
225 |
226 | b.ToTable("PersistedGrants");
227 | });
228 |
229 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
230 | {
231 | b.Property("Id")
232 | .HasColumnType("TEXT");
233 |
234 | b.Property("ConcurrencyStamp")
235 | .IsConcurrencyToken()
236 | .HasColumnType("TEXT");
237 |
238 | b.Property("Name")
239 | .HasMaxLength(256)
240 | .HasColumnType("TEXT");
241 |
242 | b.Property("NormalizedName")
243 | .HasMaxLength(256)
244 | .HasColumnType("TEXT");
245 |
246 | b.HasKey("Id");
247 |
248 | b.HasIndex("NormalizedName")
249 | .IsUnique()
250 | .HasDatabaseName("RoleNameIndex");
251 |
252 | b.ToTable("AspNetRoles");
253 | });
254 |
255 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
256 | {
257 | b.Property("Id")
258 | .ValueGeneratedOnAdd()
259 | .HasColumnType("INTEGER");
260 |
261 | b.Property("ClaimType")
262 | .HasColumnType("TEXT");
263 |
264 | b.Property("ClaimValue")
265 | .HasColumnType("TEXT");
266 |
267 | b.Property("RoleId")
268 | .IsRequired()
269 | .HasColumnType("TEXT");
270 |
271 | b.HasKey("Id");
272 |
273 | b.HasIndex("RoleId");
274 |
275 | b.ToTable("AspNetRoleClaims");
276 | });
277 |
278 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
279 | {
280 | b.Property("Id")
281 | .ValueGeneratedOnAdd()
282 | .HasColumnType("INTEGER");
283 |
284 | b.Property("ClaimType")
285 | .HasColumnType("TEXT");
286 |
287 | b.Property("ClaimValue")
288 | .HasColumnType("TEXT");
289 |
290 | b.Property("UserId")
291 | .IsRequired()
292 | .HasColumnType("TEXT");
293 |
294 | b.HasKey("Id");
295 |
296 | b.HasIndex("UserId");
297 |
298 | b.ToTable("AspNetUserClaims");
299 | });
300 |
301 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
302 | {
303 | b.Property("LoginProvider")
304 | .HasMaxLength(128)
305 | .HasColumnType("TEXT");
306 |
307 | b.Property("ProviderKey")
308 | .HasMaxLength(128)
309 | .HasColumnType("TEXT");
310 |
311 | b.Property("ProviderDisplayName")
312 | .HasColumnType("TEXT");
313 |
314 | b.Property("UserId")
315 | .IsRequired()
316 | .HasColumnType("TEXT");
317 |
318 | b.HasKey("LoginProvider", "ProviderKey");
319 |
320 | b.HasIndex("UserId");
321 |
322 | b.ToTable("AspNetUserLogins");
323 | });
324 |
325 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
326 | {
327 | b.Property("UserId")
328 | .HasColumnType("TEXT");
329 |
330 | b.Property("RoleId")
331 | .HasColumnType("TEXT");
332 |
333 | b.HasKey("UserId", "RoleId");
334 |
335 | b.HasIndex("RoleId");
336 |
337 | b.ToTable("AspNetUserRoles");
338 | });
339 |
340 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
341 | {
342 | b.Property("UserId")
343 | .HasColumnType("TEXT");
344 |
345 | b.Property("LoginProvider")
346 | .HasMaxLength(128)
347 | .HasColumnType("TEXT");
348 |
349 | b.Property("Name")
350 | .HasMaxLength(128)
351 | .HasColumnType("TEXT");
352 |
353 | b.Property("Value")
354 | .HasColumnType("TEXT");
355 |
356 | b.HasKey("UserId", "LoginProvider", "Name");
357 |
358 | b.ToTable("AspNetUserTokens");
359 | });
360 |
361 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
362 | {
363 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
364 | .WithMany()
365 | .HasForeignKey("RoleId")
366 | .OnDelete(DeleteBehavior.Cascade)
367 | .IsRequired();
368 | });
369 |
370 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
371 | {
372 | b.HasOne("ASPWebApp.Models.ApplicationUser", null)
373 | .WithMany()
374 | .HasForeignKey("UserId")
375 | .OnDelete(DeleteBehavior.Cascade)
376 | .IsRequired();
377 | });
378 |
379 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
380 | {
381 | b.HasOne("ASPWebApp.Models.ApplicationUser", null)
382 | .WithMany()
383 | .HasForeignKey("UserId")
384 | .OnDelete(DeleteBehavior.Cascade)
385 | .IsRequired();
386 | });
387 |
388 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
389 | {
390 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
391 | .WithMany()
392 | .HasForeignKey("RoleId")
393 | .OnDelete(DeleteBehavior.Cascade)
394 | .IsRequired();
395 |
396 | b.HasOne("ASPWebApp.Models.ApplicationUser", null)
397 | .WithMany()
398 | .HasForeignKey("UserId")
399 | .OnDelete(DeleteBehavior.Cascade)
400 | .IsRequired();
401 | });
402 |
403 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
404 | {
405 | b.HasOne("ASPWebApp.Models.ApplicationUser", null)
406 | .WithMany()
407 | .HasForeignKey("UserId")
408 | .OnDelete(DeleteBehavior.Cascade)
409 | .IsRequired();
410 | });
411 | #pragma warning restore 612, 618
412 | }
413 | }
414 | }
--------------------------------------------------------------------------------
/Data/Migrations/00000000000000_CreateIdentitySchema.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.EntityFrameworkCore.Migrations;
3 |
4 | namespace ASPWebApp.Data.Migrations
5 | {
6 | public partial class CreateIdentitySchema : Migration
7 | {
8 | protected override void Up(MigrationBuilder migrationBuilder)
9 | {
10 | migrationBuilder.CreateTable(
11 | name: "AspNetRoles",
12 | columns: table => new
13 | {
14 | Id = table.Column(type: "TEXT", nullable: false),
15 | Name = table.Column(type: "TEXT", maxLength: 256, nullable: true),
16 | NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true),
17 | ConcurrencyStamp = table.Column(type: "TEXT", nullable: true)
18 | },
19 | constraints: table => { table.PrimaryKey("PK_AspNetRoles", x => x.Id); });
20 |
21 | migrationBuilder.CreateTable(
22 | name: "AspNetUsers",
23 | columns: table => new
24 | {
25 | Id = table.Column(type: "TEXT", nullable: false),
26 | UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true),
27 | NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true),
28 | Email = table.Column(type: "TEXT", maxLength: 256, nullable: true),
29 | NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true),
30 | EmailConfirmed = table.Column(type: "INTEGER", nullable: false),
31 | PasswordHash = table.Column(type: "TEXT", nullable: true),
32 | SecurityStamp = table.Column(type: "TEXT", nullable: true),
33 | ConcurrencyStamp = table.Column(type: "TEXT", nullable: true),
34 | PhoneNumber = table.Column(type: "TEXT", nullable: true),
35 | PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false),
36 | TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false),
37 | LockoutEnd = table.Column(type: "TEXT", nullable: true),
38 | LockoutEnabled = table.Column(type: "INTEGER", nullable: false),
39 | AccessFailedCount = table.Column(type: "INTEGER", nullable: false)
40 | },
41 | constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); });
42 |
43 | migrationBuilder.CreateTable(
44 | name: "DeviceCodes",
45 | columns: table => new
46 | {
47 | UserCode = table.Column(type: "TEXT", maxLength: 200, nullable: false),
48 | DeviceCode = table.Column(type: "TEXT", maxLength: 200, nullable: false),
49 | SubjectId = table.Column(type: "TEXT", maxLength: 200, nullable: true),
50 | SessionId = table.Column(type: "TEXT", maxLength: 100, nullable: true),
51 | ClientId = table.Column(type: "TEXT", maxLength: 200, nullable: false),
52 | Description = table.Column(type: "TEXT", maxLength: 200, nullable: true),
53 | CreationTime = table.Column(type: "TEXT", nullable: false),
54 | Expiration = table.Column(type: "TEXT", nullable: false),
55 | Data = table.Column(type: "TEXT", maxLength: 52420, nullable: false)
56 | },
57 | constraints: table => { table.PrimaryKey("PK_DeviceCodes", x => x.UserCode); });
58 |
59 | migrationBuilder.CreateTable(
60 | name: "Keys",
61 | columns: table => new
62 | {
63 | Id = table.Column(type: "TEXT", nullable: false),
64 | Version = table.Column(type: "INTEGER", nullable: false),
65 | Created = table.Column(type: "TEXT", nullable: false),
66 | Use = table.Column(type: "TEXT", maxLength: 450, nullable: true),
67 | Algorithm = table.Column(type: "TEXT", maxLength: 100, nullable: false),
68 | IsX509Certificate = table.Column(type: "INTEGER", nullable: false),
69 | DataProtected = table.Column(type: "INTEGER", nullable: false),
70 | Data = table.Column(type: "TEXT", maxLength: 52420, nullable: false)
71 | },
72 | constraints: table => { table.PrimaryKey("PK_Keys", x => x.Id); });
73 |
74 | migrationBuilder.CreateTable(
75 | name: "PersistedGrants",
76 | columns: table => new
77 | {
78 | Key = table.Column(type: "TEXT", maxLength: 200, nullable: false),
79 | Type = table.Column(type: "TEXT", maxLength: 50, nullable: false),
80 | SubjectId = table.Column(type: "TEXT", maxLength: 200, nullable: true),
81 | SessionId = table.Column(type: "TEXT", maxLength: 100, nullable: true),
82 | ClientId = table.Column(type: "TEXT", maxLength: 200, nullable: false),
83 | Description = table.Column(type: "TEXT", maxLength: 200, nullable: true),
84 | CreationTime = table.Column(type: "TEXT", nullable: false),
85 | Expiration = table.Column(type: "TEXT", nullable: true),
86 | ConsumedTime = table.Column(type: "TEXT", nullable: true),
87 | Data = table.Column(type: "TEXT", maxLength: 52420, nullable: false)
88 | },
89 | constraints: table => { table.PrimaryKey("PK_PersistedGrants", x => x.Key); });
90 |
91 | migrationBuilder.CreateTable(
92 | name: "AspNetRoleClaims",
93 | columns: table => new
94 | {
95 | Id = table.Column(type: "INTEGER", nullable: false)
96 | .Annotation("Sqlite:Autoincrement", true),
97 | RoleId = table.Column(type: "TEXT", nullable: false),
98 | ClaimType = table.Column(type: "TEXT", nullable: true),
99 | ClaimValue = table.Column(type: "TEXT", nullable: true)
100 | },
101 | constraints: table =>
102 | {
103 | table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
104 | table.ForeignKey(
105 | name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
106 | column: x => x.RoleId,
107 | principalTable: "AspNetRoles",
108 | principalColumn: "Id",
109 | onDelete: ReferentialAction.Cascade);
110 | });
111 |
112 | migrationBuilder.CreateTable(
113 | name: "AspNetUserClaims",
114 | columns: table => new
115 | {
116 | Id = table.Column(type: "INTEGER", nullable: false)
117 | .Annotation("Sqlite:Autoincrement", true),
118 | UserId = table.Column(type: "TEXT", nullable: false),
119 | ClaimType = table.Column(type: "TEXT", nullable: true),
120 | ClaimValue = table.Column(type: "TEXT", nullable: true)
121 | },
122 | constraints: table =>
123 | {
124 | table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
125 | table.ForeignKey(
126 | name: "FK_AspNetUserClaims_AspNetUsers_UserId",
127 | column: x => x.UserId,
128 | principalTable: "AspNetUsers",
129 | principalColumn: "Id",
130 | onDelete: ReferentialAction.Cascade);
131 | });
132 |
133 | migrationBuilder.CreateTable(
134 | name: "AspNetUserLogins",
135 | columns: table => new
136 | {
137 | LoginProvider = table.Column(type: "TEXT", maxLength: 128, nullable: false),
138 | ProviderKey = table.Column(type: "TEXT", maxLength: 128, nullable: false),
139 | ProviderDisplayName = table.Column(type: "TEXT", nullable: true),
140 | UserId = table.Column(type: "TEXT", nullable: false)
141 | },
142 | constraints: table =>
143 | {
144 | table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
145 | table.ForeignKey(
146 | name: "FK_AspNetUserLogins_AspNetUsers_UserId",
147 | column: x => x.UserId,
148 | principalTable: "AspNetUsers",
149 | principalColumn: "Id",
150 | onDelete: ReferentialAction.Cascade);
151 | });
152 |
153 | migrationBuilder.CreateTable(
154 | name: "AspNetUserRoles",
155 | columns: table => new
156 | {
157 | UserId = table.Column(type: "TEXT", nullable: false),
158 | RoleId = table.Column(type: "TEXT", nullable: false)
159 | },
160 | constraints: table =>
161 | {
162 | table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
163 | table.ForeignKey(
164 | name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
165 | column: x => x.RoleId,
166 | principalTable: "AspNetRoles",
167 | principalColumn: "Id",
168 | onDelete: ReferentialAction.Cascade);
169 | table.ForeignKey(
170 | name: "FK_AspNetUserRoles_AspNetUsers_UserId",
171 | column: x => x.UserId,
172 | principalTable: "AspNetUsers",
173 | principalColumn: "Id",
174 | onDelete: ReferentialAction.Cascade);
175 | });
176 |
177 | migrationBuilder.CreateTable(
178 | name: "AspNetUserTokens",
179 | columns: table => new
180 | {
181 | UserId = table.Column(type: "TEXT", nullable: false),
182 | LoginProvider = table.Column(type: "TEXT", maxLength: 128, nullable: false),
183 | Name = table.Column(type: "TEXT", maxLength: 128, nullable: false),
184 | Value = table.Column(type: "TEXT", nullable: true)
185 | },
186 | constraints: table =>
187 | {
188 | table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
189 | table.ForeignKey(
190 | name: "FK_AspNetUserTokens_AspNetUsers_UserId",
191 | column: x => x.UserId,
192 | principalTable: "AspNetUsers",
193 | principalColumn: "Id",
194 | onDelete: ReferentialAction.Cascade);
195 | });
196 |
197 | migrationBuilder.CreateIndex(
198 | name: "IX_AspNetRoleClaims_RoleId",
199 | table: "AspNetRoleClaims",
200 | column: "RoleId");
201 |
202 | migrationBuilder.CreateIndex(
203 | name: "RoleNameIndex",
204 | table: "AspNetRoles",
205 | column: "NormalizedName",
206 | unique: true);
207 |
208 | migrationBuilder.CreateIndex(
209 | name: "IX_AspNetUserClaims_UserId",
210 | table: "AspNetUserClaims",
211 | column: "UserId");
212 |
213 | migrationBuilder.CreateIndex(
214 | name: "IX_AspNetUserLogins_UserId",
215 | table: "AspNetUserLogins",
216 | column: "UserId");
217 |
218 | migrationBuilder.CreateIndex(
219 | name: "IX_AspNetUserRoles_RoleId",
220 | table: "AspNetUserRoles",
221 | column: "RoleId");
222 |
223 | migrationBuilder.CreateIndex(
224 | name: "EmailIndex",
225 | table: "AspNetUsers",
226 | column: "NormalizedEmail");
227 |
228 | migrationBuilder.CreateIndex(
229 | name: "UserNameIndex",
230 | table: "AspNetUsers",
231 | column: "NormalizedUserName",
232 | unique: true);
233 |
234 | migrationBuilder.CreateIndex(
235 | name: "IX_DeviceCodes_DeviceCode",
236 | table: "DeviceCodes",
237 | column: "DeviceCode",
238 | unique: true);
239 |
240 | migrationBuilder.CreateIndex(
241 | name: "IX_DeviceCodes_Expiration",
242 | table: "DeviceCodes",
243 | column: "Expiration");
244 |
245 | migrationBuilder.CreateIndex(
246 | name: "IX_Keys_Use",
247 | table: "Keys",
248 | column: "Use");
249 |
250 | migrationBuilder.CreateIndex(
251 | name: "IX_PersistedGrants_ConsumedTime",
252 | table: "PersistedGrants",
253 | column: "ConsumedTime");
254 |
255 | migrationBuilder.CreateIndex(
256 | name: "IX_PersistedGrants_Expiration",
257 | table: "PersistedGrants",
258 | column: "Expiration");
259 |
260 | migrationBuilder.CreateIndex(
261 | name: "IX_PersistedGrants_SubjectId_ClientId_Type",
262 | table: "PersistedGrants",
263 | columns: new[] { "SubjectId", "ClientId", "Type" });
264 |
265 | migrationBuilder.CreateIndex(
266 | name: "IX_PersistedGrants_SubjectId_SessionId_Type",
267 | table: "PersistedGrants",
268 | columns: new[] { "SubjectId", "SessionId", "Type" });
269 | }
270 |
271 | protected override void Down(MigrationBuilder migrationBuilder)
272 | {
273 | migrationBuilder.DropTable(
274 | name: "AspNetRoleClaims");
275 |
276 | migrationBuilder.DropTable(
277 | name: "AspNetUserClaims");
278 |
279 | migrationBuilder.DropTable(
280 | name: "AspNetUserLogins");
281 |
282 | migrationBuilder.DropTable(
283 | name: "AspNetUserRoles");
284 |
285 | migrationBuilder.DropTable(
286 | name: "AspNetUserTokens");
287 |
288 | migrationBuilder.DropTable(
289 | name: "DeviceCodes");
290 |
291 | migrationBuilder.DropTable(
292 | name: "Keys");
293 |
294 | migrationBuilder.DropTable(
295 | name: "PersistedGrants");
296 |
297 | migrationBuilder.DropTable(
298 | name: "AspNetRoles");
299 |
300 | migrationBuilder.DropTable(
301 | name: "AspNetUsers");
302 | }
303 | }
304 | }
--------------------------------------------------------------------------------
/Data/Migrations/20211231110352_inita.Designer.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System;
3 | using ASPWebApp.Data;
4 | using Microsoft.EntityFrameworkCore;
5 | using Microsoft.EntityFrameworkCore.Infrastructure;
6 | using Microsoft.EntityFrameworkCore.Metadata;
7 | using Microsoft.EntityFrameworkCore.Migrations;
8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
9 |
10 | #nullable disable
11 |
12 | namespace ASPWebApp.Data.Migrations
13 | {
14 | [DbContext(typeof(ApplicationDbContext))]
15 | [Migration("20211231110352_inita")]
16 | partial class inita
17 | {
18 | protected override void BuildTargetModel(ModelBuilder modelBuilder)
19 | {
20 | #pragma warning disable 612, 618
21 | modelBuilder
22 | .HasAnnotation("ProductVersion", "6.0.1")
23 | .HasAnnotation("Relational:MaxIdentifierLength", 128);
24 |
25 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
26 |
27 | modelBuilder.Entity("ASPWebApp.Models.ApplicationUser", b =>
28 | {
29 | b.Property("Id")
30 | .HasColumnType("nvarchar(450)");
31 |
32 | b.Property("AccessFailedCount")
33 | .HasColumnType("int");
34 |
35 | b.Property("ConcurrencyStamp")
36 | .IsConcurrencyToken()
37 | .HasColumnType("nvarchar(max)");
38 |
39 | b.Property("Email")
40 | .HasMaxLength(256)
41 | .HasColumnType("nvarchar(256)");
42 |
43 | b.Property("EmailConfirmed")
44 | .HasColumnType("bit");
45 |
46 | b.Property("LockoutEnabled")
47 | .HasColumnType("bit");
48 |
49 | b.Property("LockoutEnd")
50 | .HasColumnType("datetimeoffset");
51 |
52 | b.Property("NormalizedEmail")
53 | .HasMaxLength(256)
54 | .HasColumnType("nvarchar(256)");
55 |
56 | b.Property("NormalizedUserName")
57 | .HasMaxLength(256)
58 | .HasColumnType("nvarchar(256)");
59 |
60 | b.Property("PasswordHash")
61 | .HasColumnType("nvarchar(max)");
62 |
63 | b.Property("PhoneNumber")
64 | .HasColumnType("nvarchar(max)");
65 |
66 | b.Property("PhoneNumberConfirmed")
67 | .HasColumnType("bit");
68 |
69 | b.Property("SecurityStamp")
70 | .HasColumnType("nvarchar(max)");
71 |
72 | b.Property("TwoFactorEnabled")
73 | .HasColumnType("bit");
74 |
75 | b.Property("UserName")
76 | .HasMaxLength(256)
77 | .HasColumnType("nvarchar(256)");
78 |
79 | b.HasKey("Id");
80 |
81 | b.HasIndex("NormalizedEmail")
82 | .HasDatabaseName("EmailIndex");
83 |
84 | b.HasIndex("NormalizedUserName")
85 | .IsUnique()
86 | .HasDatabaseName("UserNameIndex")
87 | .HasFilter("[NormalizedUserName] IS NOT NULL");
88 |
89 | b.ToTable("AspNetUsers", (string)null);
90 | });
91 |
92 | modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b =>
93 | {
94 | b.Property("UserCode")
95 | .HasMaxLength(200)
96 | .HasColumnType("nvarchar(200)");
97 |
98 | b.Property("ClientId")
99 | .IsRequired()
100 | .HasMaxLength(200)
101 | .HasColumnType("nvarchar(200)");
102 |
103 | b.Property("CreationTime")
104 | .HasColumnType("datetime2");
105 |
106 | b.Property("Data")
107 | .IsRequired()
108 | .HasMaxLength(50000)
109 | .HasColumnType("nvarchar(max)");
110 |
111 | b.Property("Description")
112 | .HasMaxLength(200)
113 | .HasColumnType("nvarchar(200)");
114 |
115 | b.Property("DeviceCode")
116 | .IsRequired()
117 | .HasMaxLength(200)
118 | .HasColumnType("nvarchar(200)");
119 |
120 | b.Property("Expiration")
121 | .IsRequired()
122 | .HasColumnType("datetime2");
123 |
124 | b.Property("SessionId")
125 | .HasMaxLength(100)
126 | .HasColumnType("nvarchar(100)");
127 |
128 | b.Property("SubjectId")
129 | .HasMaxLength(200)
130 | .HasColumnType("nvarchar(200)");
131 |
132 | b.HasKey("UserCode");
133 |
134 | b.HasIndex("DeviceCode")
135 | .IsUnique();
136 |
137 | b.HasIndex("Expiration");
138 |
139 | b.ToTable("DeviceCodes", (string)null);
140 | });
141 |
142 | modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b =>
143 | {
144 | b.Property("Id")
145 | .HasColumnType("nvarchar(450)");
146 |
147 | b.Property("Algorithm")
148 | .IsRequired()
149 | .HasMaxLength(100)
150 | .HasColumnType("nvarchar(100)");
151 |
152 | b.Property("Created")
153 | .HasColumnType("datetime2");
154 |
155 | b.Property("Data")
156 | .IsRequired()
157 | .HasColumnType("nvarchar(max)");
158 |
159 | b.Property("DataProtected")
160 | .HasColumnType("bit");
161 |
162 | b.Property("IsX509Certificate")
163 | .HasColumnType("bit");
164 |
165 | b.Property("Use")
166 | .HasColumnType("nvarchar(450)");
167 |
168 | b.Property("Version")
169 | .HasColumnType("int");
170 |
171 | b.HasKey("Id");
172 |
173 | b.HasIndex("Use");
174 |
175 | b.ToTable("Keys");
176 | });
177 |
178 | modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b =>
179 | {
180 | b.Property("Key")
181 | .HasMaxLength(200)
182 | .HasColumnType("nvarchar(200)");
183 |
184 | b.Property("ClientId")
185 | .IsRequired()
186 | .HasMaxLength(200)
187 | .HasColumnType("nvarchar(200)");
188 |
189 | b.Property("ConsumedTime")
190 | .HasColumnType("datetime2");
191 |
192 | b.Property("CreationTime")
193 | .HasColumnType("datetime2");
194 |
195 | b.Property("Data")
196 | .IsRequired()
197 | .HasMaxLength(50000)
198 | .HasColumnType("nvarchar(max)");
199 |
200 | b.Property("Description")
201 | .HasMaxLength(200)
202 | .HasColumnType("nvarchar(200)");
203 |
204 | b.Property("Expiration")
205 | .HasColumnType("datetime2");
206 |
207 | b.Property("SessionId")
208 | .HasMaxLength(100)
209 | .HasColumnType("nvarchar(100)");
210 |
211 | b.Property("SubjectId")
212 | .HasMaxLength(200)
213 | .HasColumnType("nvarchar(200)");
214 |
215 | b.Property("Type")
216 | .IsRequired()
217 | .HasMaxLength(50)
218 | .HasColumnType("nvarchar(50)");
219 |
220 | b.HasKey("Key");
221 |
222 | b.HasIndex("ConsumedTime");
223 |
224 | b.HasIndex("Expiration");
225 |
226 | b.HasIndex("SubjectId", "ClientId", "Type");
227 |
228 | b.HasIndex("SubjectId", "SessionId", "Type");
229 |
230 | b.ToTable("PersistedGrants", (string)null);
231 | });
232 |
233 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
234 | {
235 | b.Property("Id")
236 | .HasColumnType("nvarchar(450)");
237 |
238 | b.Property("ConcurrencyStamp")
239 | .IsConcurrencyToken()
240 | .HasColumnType("nvarchar(max)");
241 |
242 | b.Property("Name")
243 | .HasMaxLength(256)
244 | .HasColumnType("nvarchar(256)");
245 |
246 | b.Property("NormalizedName")
247 | .HasMaxLength(256)
248 | .HasColumnType("nvarchar(256)");
249 |
250 | b.HasKey("Id");
251 |
252 | b.HasIndex("NormalizedName")
253 | .IsUnique()
254 | .HasDatabaseName("RoleNameIndex")
255 | .HasFilter("[NormalizedName] IS NOT NULL");
256 |
257 | b.ToTable("AspNetRoles", (string)null);
258 | });
259 |
260 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
261 | {
262 | b.Property("Id")
263 | .ValueGeneratedOnAdd()
264 | .HasColumnType("int");
265 |
266 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1);
267 |
268 | b.Property("ClaimType")
269 | .HasColumnType("nvarchar(max)");
270 |
271 | b.Property("ClaimValue")
272 | .HasColumnType("nvarchar(max)");
273 |
274 | b.Property("RoleId")
275 | .IsRequired()
276 | .HasColumnType("nvarchar(450)");
277 |
278 | b.HasKey("Id");
279 |
280 | b.HasIndex("RoleId");
281 |
282 | b.ToTable("AspNetRoleClaims", (string)null);
283 | });
284 |
285 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
286 | {
287 | b.Property("Id")
288 | .ValueGeneratedOnAdd()
289 | .HasColumnType("int");
290 |
291 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1);
292 |
293 | b.Property("ClaimType")
294 | .HasColumnType("nvarchar(max)");
295 |
296 | b.Property("ClaimValue")
297 | .HasColumnType("nvarchar(max)");
298 |
299 | b.Property("UserId")
300 | .IsRequired()
301 | .HasColumnType("nvarchar(450)");
302 |
303 | b.HasKey("Id");
304 |
305 | b.HasIndex("UserId");
306 |
307 | b.ToTable("AspNetUserClaims", (string)null);
308 | });
309 |
310 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
311 | {
312 | b.Property("LoginProvider")
313 | .HasMaxLength(128)
314 | .HasColumnType("nvarchar(128)");
315 |
316 | b.Property("ProviderKey")
317 | .HasMaxLength(128)
318 | .HasColumnType("nvarchar(128)");
319 |
320 | b.Property("ProviderDisplayName")
321 | .HasColumnType("nvarchar(max)");
322 |
323 | b.Property("UserId")
324 | .IsRequired()
325 | .HasColumnType("nvarchar(450)");
326 |
327 | b.HasKey("LoginProvider", "ProviderKey");
328 |
329 | b.HasIndex("UserId");
330 |
331 | b.ToTable("AspNetUserLogins", (string)null);
332 | });
333 |
334 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
335 | {
336 | b.Property("UserId")
337 | .HasColumnType("nvarchar(450)");
338 |
339 | b.Property("RoleId")
340 | .HasColumnType("nvarchar(450)");
341 |
342 | b.HasKey("UserId", "RoleId");
343 |
344 | b.HasIndex("RoleId");
345 |
346 | b.ToTable("AspNetUserRoles", (string)null);
347 | });
348 |
349 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
350 | {
351 | b.Property("UserId")
352 | .HasColumnType("nvarchar(450)");
353 |
354 | b.Property("LoginProvider")
355 | .HasMaxLength(128)
356 | .HasColumnType("nvarchar(128)");
357 |
358 | b.Property("Name")
359 | .HasMaxLength(128)
360 | .HasColumnType("nvarchar(128)");
361 |
362 | b.Property("Value")
363 | .HasColumnType("nvarchar(max)");
364 |
365 | b.HasKey("UserId", "LoginProvider", "Name");
366 |
367 | b.ToTable("AspNetUserTokens", (string)null);
368 | });
369 |
370 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
371 | {
372 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
373 | .WithMany()
374 | .HasForeignKey("RoleId")
375 | .OnDelete(DeleteBehavior.Cascade)
376 | .IsRequired();
377 | });
378 |
379 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
380 | {
381 | b.HasOne("ASPWebApp.Models.ApplicationUser", null)
382 | .WithMany()
383 | .HasForeignKey("UserId")
384 | .OnDelete(DeleteBehavior.Cascade)
385 | .IsRequired();
386 | });
387 |
388 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
389 | {
390 | b.HasOne("ASPWebApp.Models.ApplicationUser", null)
391 | .WithMany()
392 | .HasForeignKey("UserId")
393 | .OnDelete(DeleteBehavior.Cascade)
394 | .IsRequired();
395 | });
396 |
397 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
398 | {
399 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
400 | .WithMany()
401 | .HasForeignKey("RoleId")
402 | .OnDelete(DeleteBehavior.Cascade)
403 | .IsRequired();
404 |
405 | b.HasOne("ASPWebApp.Models.ApplicationUser", null)
406 | .WithMany()
407 | .HasForeignKey("UserId")
408 | .OnDelete(DeleteBehavior.Cascade)
409 | .IsRequired();
410 | });
411 |
412 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
413 | {
414 | b.HasOne("ASPWebApp.Models.ApplicationUser", null)
415 | .WithMany()
416 | .HasForeignKey("UserId")
417 | .OnDelete(DeleteBehavior.Cascade)
418 | .IsRequired();
419 | });
420 | #pragma warning restore 612, 618
421 | }
422 | }
423 | }
424 |
--------------------------------------------------------------------------------
/Data/Migrations/20211231110352_inita.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.EntityFrameworkCore.Migrations;
3 |
4 | #nullable disable
5 |
6 | namespace ASPWebApp.Data.Migrations
7 | {
8 | public partial class inita : Migration
9 | {
10 | protected override void Up(MigrationBuilder migrationBuilder)
11 | {
12 | migrationBuilder.DropIndex(
13 | name: "UserNameIndex",
14 | table: "AspNetUsers");
15 |
16 | migrationBuilder.DropIndex(
17 | name: "RoleNameIndex",
18 | table: "AspNetRoles");
19 |
20 | migrationBuilder.AlterColumn