| | | 1 | | using Microsoft.EntityFrameworkCore; |
| | | 2 | | using Microsoft.EntityFrameworkCore.Metadata.Builders; |
| | | 3 | | using ProjectTemplate.Infrastructure.Data.Entities; |
| | | 4 | | |
| | | 5 | | namespace ProjectTemplate.Infrastructure.Data.Configurations; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// Configures the EF Core mapping for <see cref="ExternalLoginAccount" />. |
| | | 9 | | /// </summary> |
| | | 10 | | public sealed class ExternalLoginAccountConfiguration : IEntityTypeConfiguration<ExternalLoginAccount> |
| | | 11 | | { |
| | | 12 | | /// <inheritdoc /> |
| | | 13 | | public void Configure(EntityTypeBuilder<ExternalLoginAccount> builder) |
| | | 14 | | { |
| | 6 | 15 | | builder.ToTable("ExternalLoginAccounts"); |
| | | 16 | | |
| | 6 | 17 | | builder.HasKey(x => x.Id); |
| | | 18 | | |
| | 6 | 19 | | builder.Property(x => x.Id) |
| | 6 | 20 | | .ValueGeneratedNever(); |
| | | 21 | | |
| | 6 | 22 | | builder.Property(x => x.LocalUserId) |
| | 6 | 23 | | .IsRequired(); |
| | | 24 | | |
| | 6 | 25 | | builder.Property(x => x.ProviderName) |
| | 6 | 26 | | .HasMaxLength(100) |
| | 6 | 27 | | .IsRequired(); |
| | | 28 | | |
| | 6 | 29 | | builder.Property(x => x.NormalizedProviderName) |
| | 6 | 30 | | .HasMaxLength(100) |
| | 6 | 31 | | .IsRequired(); |
| | | 32 | | |
| | 6 | 33 | | builder.Property(x => x.ProviderUserId) |
| | 6 | 34 | | .HasMaxLength(256) |
| | 6 | 35 | | .IsRequired(); |
| | | 36 | | |
| | 6 | 37 | | builder.Property(x => x.DisplayName) |
| | 6 | 38 | | .HasMaxLength(200); |
| | | 39 | | |
| | 6 | 40 | | builder.Property(x => x.Email) |
| | 6 | 41 | | .HasMaxLength(320); |
| | | 42 | | |
| | 6 | 43 | | builder.Property(x => x.NormalizedEmail) |
| | 6 | 44 | | .HasMaxLength(320); |
| | | 45 | | |
| | 6 | 46 | | builder.Property(x => x.CreatedOnUtc) |
| | 6 | 47 | | .IsRequired(); |
| | | 48 | | |
| | 6 | 49 | | builder.HasIndex(x => new { x.NormalizedProviderName, x.ProviderUserId }) |
| | 6 | 50 | | .IsUnique(); |
| | | 51 | | |
| | 6 | 52 | | builder.HasIndex(x => x.LocalUserId); |
| | | 53 | | |
| | 6 | 54 | | builder.HasIndex(x => x.Email); |
| | | 55 | | |
| | 6 | 56 | | builder.HasIndex(x => x.NormalizedEmail); |
| | 6 | 57 | | } |
| | | 58 | | } |