diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b133c21ce..ed0702bc4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -57,7 +57,8 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: '8.0.x' + dotnet-version: 9.0.x + - name: Restore dependencies run: dotnet restore CleanArchitecture.Blazor.sln diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 7aaebf8c2..948db89d7 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -19,7 +19,8 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x + - name: Restore dependencies run: dotnet restore CleanArchitecture.Blazor.sln - name: Build diff --git a/CleanArchitecture.Blazor.sln b/CleanArchitecture.Blazor.sln index 15017c153..957ab1033 100644 --- a/CleanArchitecture.Blazor.sln +++ b/CleanArchitecture.Blazor.sln @@ -9,6 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .gitignore = .gitignore CleanArchitecture.Blazor.nuspec = CleanArchitecture.Blazor.nuspec README.md = README.md + Dockerfile = Dockerfile EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{21DC0B96-ED87-4130-BA8D-E8CF73903344}" diff --git a/Dockerfile b/Dockerfile index b77cb50ce..ae994c76e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base # apt update and install fonts RUN echo "deb http://deb.debian.org/debian/ bookworm main contrib" > /etc/apt/sources.list && \ echo "deb-src http://deb.debian.org/debian/ bookworm main contrib" >> /etc/apt/sources.list && \ @@ -33,7 +33,7 @@ EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["src/Migrators/Migrators.MSSQL/Migrators.MSSQL.csproj", "src/Migrators/Migrators.MSSQL/"] diff --git a/README.md b/README.md index eca9e2ee2..77f89d3b9 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,12 @@ Explore the application's features and design through screenshots and a video wa To get started with development, ensure you have the following tools and environments set up: -- Microsoft Visual Studio Community 2022 (64-bit) -- Docker -- .NET 8.0 -- Unit Test Framework + +- [.NET 9.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) +- [Microsoft Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) or [Rider](https://www.jetbrains.com/rider/) +- [Docker](https://www.docker.com/) + + ## Authentication Setup diff --git a/docker-compose.yml b/docker-compose.yml index 3386eda3e..3429412c6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3.8' +version: '3.8' services: dashboard: @@ -16,6 +16,13 @@ services: - SmtpClientOptions__Port= - SmtpClientOptions__User= - SmtpClientOptions__Password= + - SmtpClientOptions__DefaultFromEmail= + - Authentication__Microsoft__ClientId= + - Authentication__Microsoft__ClientSecret= + - Authentication__Google__ClientId= + - Authentication__Google__ClientSecret= + - ASPNETCORE_HTTP_PORTS=80 + - ASPNETCORE_HTTPS_PORTS=443 - ASPNETCORE_URLS=https://+:443;http://+:80 #- ASPNETCORE_Kestrel__Certificates__Default__Password=Password@123 #- ASPNETCORE_Kestrel__Certificates__Default__Path=/root/.aspnet/https/CleanArchitecture.Blazor.Server.UI.pfx @@ -30,7 +37,7 @@ services: restart: on-failure sqldb: - image: "mcr.microsoft.com/mssql/server:2019-latest" + image: "mcr.microsoft.com/mssql/server:2022-latest" environment: - "SA_PASSWORD=Password@123" - "ACCEPT_EULA=Y" diff --git a/src/Application/Application.csproj b/src/Application/Application.csproj index 6900bbe11..9a10ef9fa 100644 --- a/src/Application/Application.csproj +++ b/src/Application/Application.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0 CleanArchitecture.Blazor.Application CleanArchitecture.Blazor.Application enable @@ -8,7 +8,7 @@ default - + @@ -17,17 +17,14 @@ - - - - - + + + + - - - - + + diff --git a/src/Application/Common/FusionCache/FusionCacheFactory.cs b/src/Application/Common/FusionCache/FusionCacheFactory.cs new file mode 100644 index 000000000..e3cab3f85 --- /dev/null +++ b/src/Application/Common/FusionCache/FusionCacheFactory.cs @@ -0,0 +1,41 @@ +using Microsoft.Extensions.DependencyInjection; +using ZiggyCreatures.Caching.Fusion; + +namespace CleanArchitecture.Blazor.Application.Common.FusionCache; +public static class FusionCacheFactory +{ + private static IServiceProvider? _serviceProvider; + + public static void Configure(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + } + + public static IFusionCache GetCache() + { + if (_serviceProvider == null) + throw new InvalidOperationException("Service provider not configured."); + + return _serviceProvider.GetRequiredService(); + } + public static void ClearCache() + { + if (_serviceProvider == null) + throw new InvalidOperationException("Service provider not configured."); + var cache = _serviceProvider.GetRequiredService(); + cache.Clear(); + } + public static void RemoveByTags(IEnumerable? tags) + { + if (_serviceProvider == null) + throw new InvalidOperationException("Service provider not configured."); + var cache = _serviceProvider.GetRequiredService(); + if(tags is not null && tags.Any()) + { + foreach(var tag in tags) + { + cache.RemoveByTag(tag); + } + } + } +} diff --git a/src/Application/Common/Interfaces/Caching/ICacheInvalidatorRequest.cs b/src/Application/Common/Interfaces/Caching/ICacheInvalidatorRequest.cs index 69686b22a..6a1c3d1db 100644 --- a/src/Application/Common/Interfaces/Caching/ICacheInvalidatorRequest.cs +++ b/src/Application/Common/Interfaces/Caching/ICacheInvalidatorRequest.cs @@ -6,7 +6,7 @@ namespace CleanArchitecture.Blazor.Application.Common.Interfaces.Caching; public interface ICacheInvalidatorRequest : IRequest { string CacheKey => string.Empty; - CancellationTokenSource? SharedExpiryTokenSource { get; } + IEnumerable? Tags { get; } } public interface IFusionCacheRefreshRequest : IRequest diff --git a/src/Application/Common/Interfaces/Caching/ICacheableRequest.cs b/src/Application/Common/Interfaces/Caching/ICacheableRequest.cs index c38acaa5b..5bbe7b3ed 100644 --- a/src/Application/Common/Interfaces/Caching/ICacheableRequest.cs +++ b/src/Application/Common/Interfaces/Caching/ICacheableRequest.cs @@ -6,7 +6,7 @@ namespace CleanArchitecture.Blazor.Application.Common.Interfaces.Caching; public interface ICacheableRequest : IRequest { string CacheKey => string.Empty; - MemoryCacheEntryOptions? Options { get; } + IEnumerable? Tags { get; } } public interface IFusionCacheRequest : IRequest diff --git a/src/Application/Common/Interfaces/Identity/ICurrentUserAccessor.cs b/src/Application/Common/Interfaces/Identity/ICurrentUserAccessor.cs index 6bd21b537..e7aa64279 100644 --- a/src/Application/Common/Interfaces/Identity/ICurrentUserAccessor.cs +++ b/src/Application/Common/Interfaces/Identity/ICurrentUserAccessor.cs @@ -1,6 +1,4 @@ -using Org.BouncyCastle.Bcpg; - -namespace CleanArchitecture.Blazor.Application.Common.Interfaces.Identity; +namespace CleanArchitecture.Blazor.Application.Common.Interfaces.Identity; /// /// Interface to access the current user's session information. diff --git a/src/Application/Common/Interfaces/Identity/ICurrentUserContextSetter.cs b/src/Application/Common/Interfaces/Identity/ICurrentUserContextSetter.cs index 22fb43c4b..7b0f029b5 100644 --- a/src/Application/Common/Interfaces/Identity/ICurrentUserContextSetter.cs +++ b/src/Application/Common/Interfaces/Identity/ICurrentUserContextSetter.cs @@ -1,4 +1,6 @@ -namespace CleanArchitecture.Blazor.Application.Common.Interfaces.Identity; +using System.Security.Claims; + +namespace CleanArchitecture.Blazor.Application.Common.Interfaces.Identity; /// /// Interface for setting and clearing the current user context. @@ -8,8 +10,8 @@ public interface ICurrentUserContextSetter /// /// Sets the current user context with the provided session information. /// - /// The session information of the current user. - void SetCurrentUser(SessionInfo sessionInfo); + /// The session information of the current user. + void SetCurrentUser(ClaimsPrincipal user); /// /// Clears the current user context. diff --git a/src/Application/Common/Mappings/MappingExtensions.cs b/src/Application/Common/Mappings/MappingExtensions.cs deleted file mode 100644 index 4263d848f..000000000 --- a/src/Application/Common/Mappings/MappingExtensions.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace CleanArchitecture.Blazor.Application.Common.Mappings; - -public static class MappingExtensions -{ - public static Task> PaginatedListAsync( - this IQueryable queryable, ISpecification spec, int pageNumber, int pageSize, - CancellationToken cancellationToken = default) where TDestination : class - { - return PaginatedList.CreateAsync(queryable.AsNoTracking(), pageNumber, pageSize); - } - - public static Task> PaginatedDataAsync( - this IQueryable queryable, int pageNumber, int pageSize) where TDestination : class - { - return PaginatedData.CreateAsync(queryable.AsNoTracking(), pageNumber, pageSize); - } - -} \ No newline at end of file diff --git a/src/Application/DependencyInjection.cs b/src/Application/DependencyInjection.cs index 0adca3f15..08f43232d 100644 --- a/src/Application/DependencyInjection.cs +++ b/src/Application/DependencyInjection.cs @@ -5,6 +5,7 @@ using CleanArchitecture.Blazor.Application.Pipeline; using CleanArchitecture.Blazor.Application.Pipeline.PreProcessors; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; namespace CleanArchitecture.Blazor.Application; @@ -20,14 +21,15 @@ public static IServiceCollection AddApplication(this IServiceCollection services config.NotificationPublisher = new ParallelNoWaitPublisher(); config.AddRequestPreProcessor(typeof(IRequestPreProcessor<>), typeof(ValidationPreProcessor<>)); config.AddOpenBehavior(typeof(PerformanceBehaviour<,>)); - config.AddOpenBehavior(typeof(MemoryCacheBehaviour<,>)); config.AddOpenBehavior(typeof(FusionCacheBehaviour<,>)); config.AddOpenBehavior(typeof(CacheInvalidationBehaviour<,>)); }); - - services.AddLazyCache(); services.AddScoped(); return services; } + public static void InitializeCacheFactory(this IHost host) + { + FusionCacheFactory.Configure(host.Services); + } } \ No newline at end of file diff --git a/src/Application/Features/AuditTrails/Caching/AuditTrailsCacheKey.cs b/src/Application/Features/AuditTrails/Caching/AuditTrailsCacheKey.cs index 9804a817d..691d264dd 100644 --- a/src/Application/Features/AuditTrails/Caching/AuditTrailsCacheKey.cs +++ b/src/Application/Features/AuditTrails/Caching/AuditTrailsCacheKey.cs @@ -6,42 +6,16 @@ namespace CleanArchitecture.Blazor.Application.Features.AuditTrails.Caching; public static class AuditTrailsCacheKey { public const string GetAllCacheKey = "all-audittrails"; - private static readonly TimeSpan RefreshInterval = TimeSpan.FromSeconds(30); - private static readonly object _tokenLock = new(); - private static CancellationTokenSource _tokenSource = new(RefreshInterval); - - - public static MemoryCacheEntryOptions MemoryCacheEntryOptions => - new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(GetOrCreateTokenSource().Token)); public static string GetPaginationCacheKey(string parameters) { return $"AuditTrailsWithPaginationQuery,{parameters}"; } - public static CancellationTokenSource GetOrCreateTokenSource() - { - lock (_tokenLock) - { - if (_tokenSource.IsCancellationRequested) - { - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - return _tokenSource; - } - } - + public static IEnumerable? Tags => new string[] { "audittrail" }; public static void Refresh() { - lock (_tokenLock) - { - if (!_tokenSource.IsCancellationRequested) - { - _tokenSource.Cancel(); - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - } + FusionCacheFactory.RemoveByTags(Tags); } + } \ No newline at end of file diff --git a/src/Application/Features/AuditTrails/Queries/PaginationQuery/AuditTrailsWithPaginationQuery.cs b/src/Application/Features/AuditTrails/Queries/PaginationQuery/AuditTrailsWithPaginationQuery.cs index 2ba3df0dd..c3abcd8d4 100644 --- a/src/Application/Features/AuditTrails/Queries/PaginationQuery/AuditTrailsWithPaginationQuery.cs +++ b/src/Application/Features/AuditTrails/Queries/PaginationQuery/AuditTrailsWithPaginationQuery.cs @@ -12,7 +12,7 @@ public class AuditTrailsWithPaginationQuery : AuditTrailAdvancedFilter, ICacheab { public AuditTrailAdvancedSpecification Specification => new(this); public string CacheKey => AuditTrailsCacheKey.GetPaginationCacheKey($"{this}"); - public MemoryCacheEntryOptions? Options => AuditTrailsCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => AuditTrailsCacheKey.Tags; public override string ToString() { diff --git a/src/Application/Features/Contacts/Caching/ContactCacheKey.cs b/src/Application/Features/Contacts/Caching/ContactCacheKey.cs index 01638fe4f..eb2d58a4f 100644 --- a/src/Application/Features/Contacts/Caching/ContactCacheKey.cs +++ b/src/Application/Features/Contacts/Caching/ContactCacheKey.cs @@ -5,8 +5,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // Defines static methods and properties for managing cache keys and expiration // settings for Contact-related data. This includes creating unique cache keys for @@ -22,60 +22,23 @@ namespace CleanArchitecture.Blazor.Application.Features.Contacts.Caching; /// public static class ContactCacheKey { - // Defines the refresh interval for the cache expiration token - private static readonly TimeSpan RefreshInterval = TimeSpan.FromMinutes(30); - // Object used for locking to ensure thread safety - private static readonly object TokenLock = new(); - // CancellationTokenSource used for managing cache expiration - private static CancellationTokenSource _tokenSource = new (RefreshInterval); - /// - /// Gets the memory cache entry options with an expiration token. - /// - public static MemoryCacheEntryOptions MemoryCacheEntryOptions => - new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(GetOrCreateTokenSource().Token)); - public const string GetAllCacheKey = "all-Contacts"; public static string GetPaginationCacheKey(string parameters) { return $"ContactCacheKey:ContactsWithPaginationQuery,{parameters}"; } + public static string GetExportCacheKey(string parameters) { + return $"ContactCacheKey:ExportCacheKey,{parameters}"; + } public static string GetByNameCacheKey(string parameters) { return $"ContactCacheKey:GetByNameCacheKey,{parameters}"; } public static string GetByIdCacheKey(string parameters) { return $"ContactCacheKey:GetByIdCacheKey,{parameters}"; } - - - /// - /// Gets or creates a new with the specified refresh interval. - /// - /// The current or new . - public static CancellationTokenSource GetOrCreateTokenSource() - { - lock (TokenLock) - { - if (_tokenSource.IsCancellationRequested) - { - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - return _tokenSource; - } - } - /// - /// Refreshes the cache expiration token by cancelling and recreating the . - /// + public static IEnumerable? Tags => new string[] { "contact" }; public static void Refresh() { - lock (TokenLock) - { - if (!_tokenSource.IsCancellationRequested) - { - _tokenSource.Cancel(); - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - } + FusionCacheFactory.RemoveByTags(Tags); } } diff --git a/src/Application/Features/Contacts/Commands/AddEdit/AddEditContactCommand.cs b/src/Application/Features/Contacts/Commands/AddEdit/AddEditContactCommand.cs index b01fa347f..e6699365d 100644 --- a/src/Application/Features/Contacts/Commands/AddEdit/AddEditContactCommand.cs +++ b/src/Application/Features/Contacts/Commands/AddEdit/AddEditContactCommand.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // This file defines the command for adding or editing a contact entity, // including validation and mapping operations. It handles domain events @@ -45,7 +45,7 @@ public class AddEditContactCommand: ICacheInvalidatorRequest> public string CacheKey => ContactCacheKey.GetAllCacheKey; - public CancellationTokenSource? SharedExpiryTokenSource => ContactCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => ContactCacheKey.Tags; } public class AddEditContactCommandHandler : IRequestHandler> diff --git a/src/Application/Features/Contacts/Commands/AddEdit/AddEditContactCommandValidator.cs b/src/Application/Features/Contacts/Commands/AddEdit/AddEditContactCommandValidator.cs index a8c2d5477..c2dcbc7e9 100644 --- a/src/Application/Features/Contacts/Commands/AddEdit/AddEditContactCommandValidator.cs +++ b/src/Application/Features/Contacts/Commands/AddEdit/AddEditContactCommandValidator.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // This file defines the validation rules for the AddEditContactCommand // used to add or edit Contact entities within the CleanArchitecture.Blazor diff --git a/src/Application/Features/Contacts/Commands/Create/CreateContactCommand.cs b/src/Application/Features/Contacts/Commands/Create/CreateContactCommand.cs index 5521560b4..848a7828c 100644 --- a/src/Application/Features/Contacts/Commands/Create/CreateContactCommand.cs +++ b/src/Application/Features/Contacts/Commands/Create/CreateContactCommand.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // This file defines the command and its handler for creating a new Contact entity // within the CleanArchitecture.Blazor application. The command uses caching @@ -46,7 +46,7 @@ public class CreateContactCommand: ICacheInvalidatorRequest> public string? Country {get;set;} public string CacheKey => ContactCacheKey.GetAllCacheKey; - public CancellationTokenSource? SharedExpiryTokenSource => ContactCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => ContactCacheKey.Tags; } public class CreateContactCommandHandler : IRequestHandler> diff --git a/src/Application/Features/Contacts/Commands/Create/CreateContactCommandValidator.cs b/src/Application/Features/Contacts/Commands/Create/CreateContactCommandValidator.cs index 19c79d2f6..5d423379a 100644 --- a/src/Application/Features/Contacts/Commands/Create/CreateContactCommandValidator.cs +++ b/src/Application/Features/Contacts/Commands/Create/CreateContactCommandValidator.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // This file defines the validation rules for the CreateContactCommand, // used to create Contact entities within the CleanArchitecture.Blazor diff --git a/src/Application/Features/Contacts/Commands/Delete/DeleteContactCommand.cs b/src/Application/Features/Contacts/Commands/Delete/DeleteContactCommand.cs index f6e2a20d9..4fda2fd3a 100644 --- a/src/Application/Features/Contacts/Commands/Delete/DeleteContactCommand.cs +++ b/src/Application/Features/Contacts/Commands/Delete/DeleteContactCommand.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // This file defines the command and its handler for deleting one or more // Contact entities from the CleanArchitecture.Blazor application. It @@ -35,7 +35,7 @@ public class DeleteContactCommand: ICacheInvalidatorRequest> { public int[] Id { get; } public string CacheKey => ContactCacheKey.GetAllCacheKey; - public CancellationTokenSource? SharedExpiryTokenSource => ContactCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => ContactCacheKey.Tags; public DeleteContactCommand(int[] id) { Id = id; diff --git a/src/Application/Features/Contacts/Commands/Delete/DeleteContactCommandValidator.cs b/src/Application/Features/Contacts/Commands/Delete/DeleteContactCommandValidator.cs index 2a997956e..c9c39b918 100644 --- a/src/Application/Features/Contacts/Commands/Delete/DeleteContactCommandValidator.cs +++ b/src/Application/Features/Contacts/Commands/Delete/DeleteContactCommandValidator.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // This file defines the validation rules for the DeleteContactCommand used // to delete Contact entities within the CleanArchitecture.Blazor application. diff --git a/src/Application/Features/Contacts/Commands/Import/ImportContactsCommand.cs b/src/Application/Features/Contacts/Commands/Import/ImportContactsCommand.cs index 3969698d8..468e53327 100644 --- a/src/Application/Features/Contacts/Commands/Import/ImportContactsCommand.cs +++ b/src/Application/Features/Contacts/Commands/Import/ImportContactsCommand.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // This file defines the command, handler, and associated logic for importing // contacts from an Excel file into the CleanArchitecture.Blazor application. @@ -37,7 +37,7 @@ public class ImportContactsCommand: ICacheInvalidatorRequest> public string FileName { get; set; } public byte[] Data { get; set; } public string CacheKey => ContactCacheKey.GetAllCacheKey; - public CancellationTokenSource? SharedExpiryTokenSource => ContactCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => ContactCacheKey.Tags; public ImportContactsCommand(string fileName,byte[] data) { FileName = fileName; diff --git a/src/Application/Features/Contacts/Commands/Import/ImportContactsCommandValidator.cs b/src/Application/Features/Contacts/Commands/Import/ImportContactsCommandValidator.cs index b98a676dd..879953de0 100644 --- a/src/Application/Features/Contacts/Commands/Import/ImportContactsCommandValidator.cs +++ b/src/Application/Features/Contacts/Commands/Import/ImportContactsCommandValidator.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // This file defines the validation rules for the ImportContactsCommand // within the CleanArchitecture.Blazor application. It ensures that the diff --git a/src/Application/Features/Contacts/Commands/Update/UpdateContactCommand.cs b/src/Application/Features/Contacts/Commands/Update/UpdateContactCommand.cs index 24ea31e11..17492f55c 100644 --- a/src/Application/Features/Contacts/Commands/Update/UpdateContactCommand.cs +++ b/src/Application/Features/Contacts/Commands/Update/UpdateContactCommand.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // This file defines the UpdateContactCommand and its handler for updating // an existing Contact entity within the CleanArchitecture.Blazor application. @@ -45,8 +45,8 @@ public class UpdateContactCommand: ICacheInvalidatorRequest> [Description("Country")] public string? Country {get;set;} - public string CacheKey => ContactCacheKey.GetAllCacheKey; - public CancellationTokenSource? SharedExpiryTokenSource => ContactCacheKey.GetOrCreateTokenSource(); + public string CacheKey => ContactCacheKey.GetAllCacheKey; + public IEnumerable? Tags => ContactCacheKey.Tags; } diff --git a/src/Application/Features/Contacts/Commands/Update/UpdateContactCommandValidator.cs b/src/Application/Features/Contacts/Commands/Update/UpdateContactCommandValidator.cs index 446aea5ba..865f235db 100644 --- a/src/Application/Features/Contacts/Commands/Update/UpdateContactCommandValidator.cs +++ b/src/Application/Features/Contacts/Commands/Update/UpdateContactCommandValidator.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // This file defines the validation rules for the UpdateContactCommand within // the CleanArchitecture.Blazor application. It ensures that the command has diff --git a/src/Application/Features/Contacts/DTOs/ContactDto.cs b/src/Application/Features/Contacts/DTOs/ContactDto.cs index da80808b6..0acfc47e7 100644 --- a/src/Application/Features/Contacts/DTOs/ContactDto.cs +++ b/src/Application/Features/Contacts/DTOs/ContactDto.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // This file defines the Data Transfer Object (DTO) for the Contact entity // used within the CleanArchitecture.Blazor application. The ContactDto is diff --git a/src/Application/Features/Contacts/EventHandlers/ContactCreatedEventHandler.cs b/src/Application/Features/Contacts/EventHandlers/ContactCreatedEventHandler.cs index f703987cf..2646e9d28 100644 --- a/src/Application/Features/Contacts/EventHandlers/ContactCreatedEventHandler.cs +++ b/src/Application/Features/Contacts/EventHandlers/ContactCreatedEventHandler.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // Handles the `ContactCreatedEvent` which occurs when a new contact is created. // This event handler can be extended to trigger additional actions, such as diff --git a/src/Application/Features/Contacts/EventHandlers/ContactDeletedEventHandler.cs b/src/Application/Features/Contacts/EventHandlers/ContactDeletedEventHandler.cs index 0c1fa349e..3293d114b 100644 --- a/src/Application/Features/Contacts/EventHandlers/ContactDeletedEventHandler.cs +++ b/src/Application/Features/Contacts/EventHandlers/ContactDeletedEventHandler.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // Handles the `ContactDeletedEvent` which occurs when a new contact is deleted. // This event handler can be extended to trigger additional actions, such as diff --git a/src/Application/Features/Contacts/EventHandlers/ContactUpdatedEventHandler.cs b/src/Application/Features/Contacts/EventHandlers/ContactUpdatedEventHandler.cs index cd1b64794..3fd1a930b 100644 --- a/src/Application/Features/Contacts/EventHandlers/ContactUpdatedEventHandler.cs +++ b/src/Application/Features/Contacts/EventHandlers/ContactUpdatedEventHandler.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // Handles the `ContactUpdatedEvent` which occurs when a new contact is updated. // This event handler can be extended to trigger additional actions, such as diff --git a/src/Application/Features/Contacts/Mappers/ContactMapper.cs b/src/Application/Features/Contacts/Mappers/ContactMapper.cs index fdd21a943..894d34d24 100644 --- a/src/Application/Features/Contacts/Mappers/ContactMapper.cs +++ b/src/Application/Features/Contacts/Mappers/ContactMapper.cs @@ -6,8 +6,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // Defines mapping methods between `Contact` entities and related DTOs/commands // within the CleanArchitecture.Blazor application. This mapper facilitates diff --git a/src/Application/Features/Contacts/Queries/Export/ExportContactsQuery.cs b/src/Application/Features/Contacts/Queries/Export/ExportContactsQuery.cs index f0bd9fe5c..399e6be87 100644 --- a/src/Application/Features/Contacts/Queries/Export/ExportContactsQuery.cs +++ b/src/Application/Features/Contacts/Queries/Export/ExportContactsQuery.cs @@ -5,8 +5,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // Defines a query to export contact data to an Excel file. This query // applies advanced filtering options and generates an Excel file with @@ -14,15 +14,22 @@ // //------------------------------------------------------------------------------ +using CleanArchitecture.Blazor.Application.Features.Contacts.Caching; using CleanArchitecture.Blazor.Application.Features.Contacts.DTOs; using CleanArchitecture.Blazor.Application.Features.Contacts.Mappers; using CleanArchitecture.Blazor.Application.Features.Contacts.Specifications; namespace CleanArchitecture.Blazor.Application.Features.Contacts.Queries.Export; -public class ExportContactsQuery : ContactAdvancedFilter, IRequest> +public class ExportContactsQuery : ContactAdvancedFilter, ICacheableRequest> { public ContactAdvancedSpecification Specification => new ContactAdvancedSpecification(this); + public IEnumerable? Tags => ContactCacheKey.Tags; + public override string ToString() + { + return $"Listview:{ListView}:{CurrentUser?.UserId}-{LocalTimezoneOffset.TotalHours}, Search:{Keyword}, {OrderBy}, {SortDirection}"; + } + public string CacheKey => ContactCacheKey.GetExportCacheKey($"{this}"); } public class ExportContactsQueryHandler : diff --git a/src/Application/Features/Contacts/Queries/GetAll/GetAllContactsQuery.cs b/src/Application/Features/Contacts/Queries/GetAll/GetAllContactsQuery.cs index c2f1e1054..a2b393188 100644 --- a/src/Application/Features/Contacts/Queries/GetAll/GetAllContactsQuery.cs +++ b/src/Application/Features/Contacts/Queries/GetAll/GetAllContactsQuery.cs @@ -5,8 +5,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // Defines a query to retrieve all contacts from the database. The result // is cached to improve performance and reduce database load for repeated @@ -23,7 +23,7 @@ namespace CleanArchitecture.Blazor.Application.Features.Contacts.Queries.GetAll; public class GetAllContactsQuery : ICacheableRequest> { public string CacheKey => ContactCacheKey.GetAllCacheKey; - public MemoryCacheEntryOptions? Options => ContactCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => ContactCacheKey.Tags; } public class GetAllContactsQueryHandler : diff --git a/src/Application/Features/Contacts/Queries/GetById/GetContactByIdQuery.cs b/src/Application/Features/Contacts/Queries/GetById/GetContactByIdQuery.cs index 0ae6b4bea..f482a939e 100644 --- a/src/Application/Features/Contacts/Queries/GetById/GetContactByIdQuery.cs +++ b/src/Application/Features/Contacts/Queries/GetById/GetContactByIdQuery.cs @@ -5,8 +5,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // Defines a query to retrieve a contact by its ID. The result is cached // to optimize performance for repeated retrievals of the same contact. @@ -24,7 +24,7 @@ public class GetContactByIdQuery : ICacheableRequest> { public required int Id { get; set; } public string CacheKey => ContactCacheKey.GetByIdCacheKey($"{Id}"); - public MemoryCacheEntryOptions? Options => ContactCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => ContactCacheKey.Tags; } public class GetContactByIdQueryHandler : diff --git a/src/Application/Features/Contacts/Queries/Pagination/ContactsPaginationQuery.cs b/src/Application/Features/Contacts/Queries/Pagination/ContactsPaginationQuery.cs index 1895c5d10..a06611554 100644 --- a/src/Application/Features/Contacts/Queries/Pagination/ContactsPaginationQuery.cs +++ b/src/Application/Features/Contacts/Queries/Pagination/ContactsPaginationQuery.cs @@ -5,8 +5,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // Defines a query for retrieving contacts with pagination and filtering // options. The result is cached to enhance performance for repeated queries. @@ -24,10 +24,10 @@ public class ContactsWithPaginationQuery : ContactAdvancedFilter, ICacheableRequ { public override string ToString() { - return $"Listview:{ListView}-{LocalTimezoneOffset.TotalHours}, Search:{Keyword}, {OrderBy}, {SortDirection}, {PageNumber}, {PageSize}"; + return $"Listview:{ListView}:{CurrentUser?.UserId}-{LocalTimezoneOffset.TotalHours}, Search:{Keyword}, {OrderBy}, {SortDirection}, {PageNumber}, {PageSize}"; } public string CacheKey => ContactCacheKey.GetPaginationCacheKey($"{this}"); - public MemoryCacheEntryOptions? Options => ContactCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => ContactCacheKey.Tags; public ContactAdvancedSpecification Specification => new ContactAdvancedSpecification(this); } diff --git a/src/Application/Features/Contacts/Specifications/ContactAdvancedFilter.cs b/src/Application/Features/Contacts/Specifications/ContactAdvancedFilter.cs index 205e0ac32..91cdd7cf9 100644 --- a/src/Application/Features/Contacts/Specifications/ContactAdvancedFilter.cs +++ b/src/Application/Features/Contacts/Specifications/ContactAdvancedFilter.cs @@ -5,8 +5,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // Defines the available views for filtering contacts and provides advanced // filtering options for contact lists. This includes pagination and various diff --git a/src/Application/Features/Contacts/Specifications/ContactAdvancedSpecification.cs b/src/Application/Features/Contacts/Specifications/ContactAdvancedSpecification.cs index bb594ccbe..1a2d36685 100644 --- a/src/Application/Features/Contacts/Specifications/ContactAdvancedSpecification.cs +++ b/src/Application/Features/Contacts/Specifications/ContactAdvancedSpecification.cs @@ -5,8 +5,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // Defines a specification for applying advanced filtering options to the // Contact entity, supporting different views and keyword-based searches. diff --git a/src/Application/Features/Contacts/Specifications/ContactByIdSpecification.cs b/src/Application/Features/Contacts/Specifications/ContactByIdSpecification.cs index dcd632a31..30307f08e 100644 --- a/src/Application/Features/Contacts/Specifications/ContactByIdSpecification.cs +++ b/src/Application/Features/Contacts/Specifications/ContactByIdSpecification.cs @@ -5,8 +5,8 @@ // See the LICENSE file in the project root for more information. // // Author: neozhu -// Created Date: 2024-11-08 -// Last Modified: 2024-11-08 +// Created Date: 2024-11-12 +// Last Modified: 2024-11-12 // Description: // Defines a specification for filtering a Contact entity by its ID. // diff --git a/src/Application/Features/Documents/Caching/DocumentCacheKey.cs b/src/Application/Features/Documents/Caching/DocumentCacheKey.cs index 06aaf41d7..c24fe274c 100644 --- a/src/Application/Features/Documents/Caching/DocumentCacheKey.cs +++ b/src/Application/Features/Documents/Caching/DocumentCacheKey.cs @@ -6,46 +6,17 @@ namespace CleanArchitecture.Blazor.Application.Features.Documents.Caching; public static class DocumentCacheKey { public const string GetAllCacheKey = "all-documents"; - private static readonly TimeSpan RefreshInterval = TimeSpan.FromHours(1); - private static readonly object _tokenLock = new(); - private static CancellationTokenSource _tokenSource = new(RefreshInterval); - - public static MemoryCacheEntryOptions MemoryCacheEntryOptions => - new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(GetOrCreateTokenSource().Token)); - public static string GetStreamByIdKey(int id) { return $"GetStreamByIdKey:{id}"; } - public static string GetPaginationCacheKey(string parameters) { return $"DocumentsWithPaginationQuery,{parameters}"; } - - public static CancellationTokenSource GetOrCreateTokenSource() - { - lock (_tokenLock) - { - if (_tokenSource.IsCancellationRequested) - { - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - return _tokenSource; - } - } - + public static IEnumerable? Tags => new string[] { "document" }; public static void Refresh() { - lock (_tokenLock) - { - if (!_tokenSource.IsCancellationRequested) - { - _tokenSource.Cancel(); - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - } + FusionCacheFactory.RemoveByTags(Tags); } -} \ No newline at end of file +} diff --git a/src/Application/Features/Documents/Commands/AddEdit/AddEditDocumentCommand.cs b/src/Application/Features/Documents/Commands/AddEdit/AddEditDocumentCommand.cs index 4cae3fb15..365584afb 100644 --- a/src/Application/Features/Documents/Commands/AddEdit/AddEditDocumentCommand.cs +++ b/src/Application/Features/Documents/Commands/AddEdit/AddEditDocumentCommand.cs @@ -19,7 +19,7 @@ public class AddEditDocumentCommand : ICacheInvalidatorRequest> [Description("Status")] public JobStatus Status { get; set; } = JobStatus.NotStart; [Description("Content")] public string? Content { get; set; } public UploadRequest? UploadRequest { get; set; } - public CancellationTokenSource? SharedExpiryTokenSource => DocumentCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => DocumentCacheKey.Tags; } diff --git a/src/Application/Features/Documents/Commands/Delete/DeleteDocumentCommand.cs b/src/Application/Features/Documents/Commands/Delete/DeleteDocumentCommand.cs index a9603718d..775824066 100644 --- a/src/Application/Features/Documents/Commands/Delete/DeleteDocumentCommand.cs +++ b/src/Application/Features/Documents/Commands/Delete/DeleteDocumentCommand.cs @@ -13,7 +13,7 @@ public DeleteDocumentCommand(int[] id) } public int[] Id { get; set; } - public CancellationTokenSource? SharedExpiryTokenSource => DocumentCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => DocumentCacheKey.Tags; } public class DeleteDocumentCommandHandler : IRequestHandler> diff --git a/src/Application/Features/Documents/Commands/Upload/UploadDocumentCommand.cs b/src/Application/Features/Documents/Commands/Upload/UploadDocumentCommand.cs index 258cee9ab..40b6624f6 100644 --- a/src/Application/Features/Documents/Commands/Upload/UploadDocumentCommand.cs +++ b/src/Application/Features/Documents/Commands/Upload/UploadDocumentCommand.cs @@ -12,7 +12,7 @@ public UploadDocumentCommand(List uploadRequests) UploadRequests = uploadRequests; } public List UploadRequests { get; set; } - public CancellationTokenSource? SharedExpiryTokenSource => DocumentCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => DocumentCacheKey.Tags; } public class UploadDocumentCommandHandler : IRequestHandler> diff --git a/src/Application/Features/Documents/Queries/GetFileStream/GetFileStreamQuery.cs b/src/Application/Features/Documents/Queries/GetFileStream/GetFileStreamQuery.cs index 836ece0f3..42fe20c4e 100644 --- a/src/Application/Features/Documents/Queries/GetFileStream/GetFileStreamQuery.cs +++ b/src/Application/Features/Documents/Queries/GetFileStream/GetFileStreamQuery.cs @@ -13,7 +13,7 @@ public GetFileStreamQuery(int id) } public int Id { get; set; } public string CacheKey => DocumentCacheKey.GetStreamByIdKey(Id); - public MemoryCacheEntryOptions? Options => DocumentCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => DocumentCacheKey.Tags; } public class GetFileStreamQueryHandler : IRequestHandler diff --git a/src/Application/Features/Documents/Queries/PaginationQuery/DocumentsWithPaginationQuery.cs b/src/Application/Features/Documents/Queries/PaginationQuery/DocumentsWithPaginationQuery.cs index 52405bf92..22aaf828d 100644 --- a/src/Application/Features/Documents/Queries/PaginationQuery/DocumentsWithPaginationQuery.cs +++ b/src/Application/Features/Documents/Queries/PaginationQuery/DocumentsWithPaginationQuery.cs @@ -13,7 +13,7 @@ public class DocumentsWithPaginationQuery : AdvancedDocumentsFilter, ICacheableR public AdvancedDocumentsSpecification Specification => new(this); public string CacheKey => DocumentCacheKey.GetPaginationCacheKey($"{this}"); - public MemoryCacheEntryOptions? Options => DocumentCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => DocumentCacheKey.Tags; public override string ToString() { diff --git a/src/Application/Features/Loggers/Caching/LogCacheKey.cs b/src/Application/Features/Loggers/Caching/LogCacheKey.cs index d54ffa113..1c73d8cc7 100644 --- a/src/Application/Features/Loggers/Caching/LogCacheKey.cs +++ b/src/Application/Features/Loggers/Caching/LogCacheKey.cs @@ -6,48 +6,17 @@ namespace CleanArchitecture.Blazor.Application.Features.Loggers.Caching; public static class LogsCacheKey { public const string GetAllCacheKey = "all-logs"; - private static readonly TimeSpan RefreshInterval = TimeSpan.FromSeconds(30); - private static readonly object _tokenLock = new(); - private static CancellationTokenSource _tokenSource = new(RefreshInterval); - - - - public static MemoryCacheEntryOptions MemoryCacheEntryOptions => - new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(GetOrCreateTokenSource().Token)); - public static string GetChartDataCacheKey(string parameters) { return $"GetChartDataCacheKey,{parameters}"; } - public static string GetPaginationCacheKey(string parameters) { return $"LogsTrailsWithPaginationQuery,{parameters}"; } - - public static CancellationTokenSource GetOrCreateTokenSource() - { - lock (_tokenLock) - { - if (_tokenSource.IsCancellationRequested) - { - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - return _tokenSource; - } - } - + public static IEnumerable? Tags => new string[] { "logs" }; public static void Refresh() { - lock (_tokenLock) - { - if (!_tokenSource.IsCancellationRequested) - { - _tokenSource.Cancel(); - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - } + FusionCacheFactory.RemoveByTags(Tags); } } \ No newline at end of file diff --git a/src/Application/Features/Loggers/Commands/Clear/ClearLogsCommand.cs b/src/Application/Features/Loggers/Commands/Clear/ClearLogsCommand.cs index 14deeaffa..6ef8134d1 100644 --- a/src/Application/Features/Loggers/Commands/Clear/ClearLogsCommand.cs +++ b/src/Application/Features/Loggers/Commands/Clear/ClearLogsCommand.cs @@ -9,7 +9,7 @@ namespace CleanArchitecture.Blazor.Application.Features.Loggers.Commands.Clear; public class ClearLogsCommand : ICacheInvalidatorRequest { public string CacheKey => LogsCacheKey.GetAllCacheKey; - public CancellationTokenSource? SharedExpiryTokenSource => LogsCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => LogsCacheKey.Tags; } public class ClearLogsCommandHandler : IRequestHandler diff --git a/src/Application/Features/Loggers/Queries/ChatData/LogsChatDataQuery.cs b/src/Application/Features/Loggers/Queries/ChatData/LogsChatDataQuery.cs index 8b645649c..ea045e1a8 100644 --- a/src/Application/Features/Loggers/Queries/ChatData/LogsChatDataQuery.cs +++ b/src/Application/Features/Loggers/Queries/ChatData/LogsChatDataQuery.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using CleanArchitecture.Blazor.Application.Features.Loggers.Caching; @@ -10,7 +10,7 @@ public class LogsTimeLineChatDataQuery : ICacheableRequest> { public DateTime LastDateTime { get; set; } = DateTime.Now.AddDays(-60); public string CacheKey => LogsCacheKey.GetChartDataCacheKey(LastDateTime.ToString()); - public MemoryCacheEntryOptions? Options => LogsCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => LogsCacheKey.Tags; } public class LogsChatDataQueryHandler : IRequestHandler> diff --git a/src/Application/Features/Loggers/Queries/PaginationQuery/LogsWithPaginationQuery.cs b/src/Application/Features/Loggers/Queries/PaginationQuery/LogsWithPaginationQuery.cs index d207cafd9..81972b17b 100644 --- a/src/Application/Features/Loggers/Queries/PaginationQuery/LogsWithPaginationQuery.cs +++ b/src/Application/Features/Loggers/Queries/PaginationQuery/LogsWithPaginationQuery.cs @@ -13,7 +13,7 @@ public class LogsWithPaginationQuery : LoggerAdvancedFilter, ICacheableRequest

new(this); public string CacheKey => LogsCacheKey.GetPaginationCacheKey($"{this}"); - public MemoryCacheEntryOptions? Options => LogsCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => LogsCacheKey.Tags; public override string ToString() { diff --git a/src/Application/Features/PicklistSets/Caching/PicklistSetCacheKey.cs b/src/Application/Features/PicklistSets/Caching/PicklistSetCacheKey.cs index 579e55853..92a8f7545 100644 --- a/src/Application/Features/PicklistSets/Caching/PicklistSetCacheKey.cs +++ b/src/Application/Features/PicklistSets/Caching/PicklistSetCacheKey.cs @@ -7,43 +7,13 @@ public static class PicklistSetCacheKey { public const string GetAllCacheKey = "all-PicklistSet"; public const string PicklistCacheKey = "all-PicklistSetcachekey"; - private static readonly TimeSpan RefreshInterval = TimeSpan.FromHours(1); - private static readonly object _tokenLock = new(); - private static CancellationTokenSource _tokenSource = new(RefreshInterval); - - - - public static MemoryCacheEntryOptions MemoryCacheEntryOptions => - new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(GetOrCreateTokenSource().Token)); - public static string GetCacheKey(string name) { return $"{name}-PicklistSet"; } - - public static CancellationTokenSource GetOrCreateTokenSource() - { - lock (_tokenLock) - { - if (_tokenSource.IsCancellationRequested) - { - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - return _tokenSource; - } - } - + public static IEnumerable? Tags => new string[] { "picklistset" }; public static void Refresh() { - lock (_tokenLock) - { - if (!_tokenSource.IsCancellationRequested) - { - _tokenSource.Cancel(); - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - } + FusionCacheFactory.RemoveByTags(Tags); } } \ No newline at end of file diff --git a/src/Application/Features/PicklistSets/Commands/AddEdit/AddEditPicklistSetCommand.cs b/src/Application/Features/PicklistSets/Commands/AddEdit/AddEditPicklistSetCommand.cs index c06446184..c735e5939 100644 --- a/src/Application/Features/PicklistSets/Commands/AddEdit/AddEditPicklistSetCommand.cs +++ b/src/Application/Features/PicklistSets/Commands/AddEdit/AddEditPicklistSetCommand.cs @@ -15,7 +15,7 @@ public class AddEditPicklistSetCommand : ICacheInvalidatorRequest> [Description("Description")] public string? Description { get; set; } public TrackingState TrackingState { get; set; } = TrackingState.Unchanged; public string CacheKey => PicklistSetCacheKey.GetAllCacheKey; - public CancellationTokenSource? SharedExpiryTokenSource => PicklistSetCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => PicklistSetCacheKey.Tags; } public class AddEditPicklistSetCommandHandler : IRequestHandler> diff --git a/src/Application/Features/PicklistSets/Commands/Delete/DeletePicklistSetCommand.cs b/src/Application/Features/PicklistSets/Commands/Delete/DeletePicklistSetCommand.cs index 403f63b21..245afe7fe 100644 --- a/src/Application/Features/PicklistSets/Commands/Delete/DeletePicklistSetCommand.cs +++ b/src/Application/Features/PicklistSets/Commands/Delete/DeletePicklistSetCommand.cs @@ -14,7 +14,7 @@ public DeletePicklistSetCommand(int[] id) public int[] Id { get; } public string CacheKey => PicklistSetCacheKey.GetAllCacheKey; - public CancellationTokenSource? SharedExpiryTokenSource => PicklistSetCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => PicklistSetCacheKey.Tags; } public class DeletePicklistSetCommandHandler : IRequestHandler> diff --git a/src/Application/Features/PicklistSets/Commands/Import/ImportPicklistSetsCommand.cs b/src/Application/Features/PicklistSets/Commands/Import/ImportPicklistSetsCommand.cs index 136cfedf9..7ead843d7 100644 --- a/src/Application/Features/PicklistSets/Commands/Import/ImportPicklistSetsCommand.cs +++ b/src/Application/Features/PicklistSets/Commands/Import/ImportPicklistSetsCommand.cs @@ -15,7 +15,7 @@ public ImportPicklistSetsCommand(string fileName, byte[] data) } public string FileName { get; set; } public byte[] Data { get; set; } - public CancellationTokenSource? SharedExpiryTokenSource => PicklistSetCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => PicklistSetCacheKey.Tags; } diff --git a/src/Application/Features/PicklistSets/Queries/ByName/PicklistSetsQueryByName.cs b/src/Application/Features/PicklistSets/Queries/ByName/PicklistSetsQueryByName.cs index 99a37b44b..e6ba3024c 100644 --- a/src/Application/Features/PicklistSets/Queries/ByName/PicklistSetsQueryByName.cs +++ b/src/Application/Features/PicklistSets/Queries/ByName/PicklistSetsQueryByName.cs @@ -15,7 +15,7 @@ public PicklistSetsQueryByName(Picklist name) } public Picklist Name { get; set; } public string CacheKey => PicklistSetCacheKey.GetCacheKey(Name.ToString()); - public MemoryCacheEntryOptions? Options => PicklistSetCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => PicklistSetCacheKey.Tags; } public class PicklistSetsQueryByNameHandler : IRequestHandler> diff --git a/src/Application/Features/PicklistSets/Queries/GetAll/GetAllPicklistSetsQuery.cs b/src/Application/Features/PicklistSets/Queries/GetAll/GetAllPicklistSetsQuery.cs index 34cb3deeb..c99b5ca9d 100644 --- a/src/Application/Features/PicklistSets/Queries/GetAll/GetAllPicklistSetsQuery.cs +++ b/src/Application/Features/PicklistSets/Queries/GetAll/GetAllPicklistSetsQuery.cs @@ -10,7 +10,7 @@ namespace CleanArchitecture.Blazor.Application.Features.PicklistSets.Queries.Get public class GetAllPicklistSetsQuery : ICacheableRequest> { public string CacheKey => PicklistSetCacheKey.GetAllCacheKey; - public MemoryCacheEntryOptions? Options => PicklistSetCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => PicklistSetCacheKey.Tags; } public class GetAllPicklistSetsQueryHandler : IRequestHandler> diff --git a/src/Application/Features/PicklistSets/Queries/PaginationQuery/PicklistSetsWithPaginationQuery.cs b/src/Application/Features/PicklistSets/Queries/PaginationQuery/PicklistSetsWithPaginationQuery.cs index 566dd4cf5..c2ead2fe1 100644 --- a/src/Application/Features/PicklistSets/Queries/PaginationQuery/PicklistSetsWithPaginationQuery.cs +++ b/src/Application/Features/PicklistSets/Queries/PaginationQuery/PicklistSetsWithPaginationQuery.cs @@ -12,7 +12,7 @@ public class PicklistSetsWithPaginationQuery : PicklistSetAdvancedFilter, ICache { public PicklistSetAdvancedSpecification Specification => new(this); public string CacheKey => $"{nameof(PicklistSetsWithPaginationQuery)},{this}"; - public MemoryCacheEntryOptions? Options => PicklistSetCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => PicklistSetCacheKey.Tags; public override string ToString() { diff --git a/src/Application/Features/Products/Caching/ProductCacheKey.cs b/src/Application/Features/Products/Caching/ProductCacheKey.cs index 10cb86c64..84b8d94c5 100644 --- a/src/Application/Features/Products/Caching/ProductCacheKey.cs +++ b/src/Application/Features/Products/Caching/ProductCacheKey.cs @@ -6,46 +6,18 @@ namespace CleanArchitecture.Blazor.Application.Features.Products.Caching; public static class ProductCacheKey { public const string GetAllCacheKey = "all-Products"; - private static readonly TimeSpan RefreshInterval = TimeSpan.FromHours(1); - private static readonly object _tokenLock = new(); - private static CancellationTokenSource _tokenSource = new (RefreshInterval); - - public static MemoryCacheEntryOptions MemoryCacheEntryOptions => - new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(GetOrCreateTokenSource().Token)); - public static string GetProductByIdCacheKey(int id) { return $"GetProductById,{id}"; } - public static string GetPaginationCacheKey(string parameters) { return $"ProductsWithPaginationQuery,{parameters}"; } - - public static CancellationTokenSource GetOrCreateTokenSource() - { - lock (_tokenLock) - { - if (_tokenSource.IsCancellationRequested) - { - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - return _tokenSource; - } - } - + public static IEnumerable? Tags => new string[] { "product" }; public static void Refresh() { - lock (_tokenLock) - { - if (!_tokenSource.IsCancellationRequested) - { - _tokenSource.Cancel(); - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - } + FusionCacheFactory.RemoveByTags(Tags); } + } diff --git a/src/Application/Features/Products/Commands/AddEdit/AddEditProductCommand.cs b/src/Application/Features/Products/Commands/AddEdit/AddEditProductCommand.cs index 090164e2e..0bef48a9e 100644 --- a/src/Application/Features/Products/Commands/AddEdit/AddEditProductCommand.cs +++ b/src/Application/Features/Products/Commands/AddEdit/AddEditProductCommand.cs @@ -20,7 +20,7 @@ public class AddEditProductCommand : ICacheInvalidatorRequest> public IReadOnlyList? UploadPictures { get; set; } public string CacheKey => ProductCacheKey.GetAllCacheKey; - public CancellationTokenSource? SharedExpiryTokenSource => ProductCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => ProductCacheKey.Tags; } public class AddEditProductCommandHandler : IRequestHandler> diff --git a/src/Application/Features/Products/Commands/Delete/DeleteProductCommand.cs b/src/Application/Features/Products/Commands/Delete/DeleteProductCommand.cs index 2512eaa82..72e5f769d 100644 --- a/src/Application/Features/Products/Commands/Delete/DeleteProductCommand.cs +++ b/src/Application/Features/Products/Commands/Delete/DeleteProductCommand.cs @@ -15,7 +15,7 @@ public DeleteProductCommand(int[] id) public int[] Id { get; } public string CacheKey => ProductCacheKey.GetAllCacheKey; - public CancellationTokenSource? SharedExpiryTokenSource => ProductCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => ProductCacheKey.Tags; } public class DeleteProductCommandHandler : diff --git a/src/Application/Features/Products/Commands/Import/ImportProductsCommand.cs b/src/Application/Features/Products/Commands/Import/ImportProductsCommand.cs index 589634983..c0a66f431 100644 --- a/src/Application/Features/Products/Commands/Import/ImportProductsCommand.cs +++ b/src/Application/Features/Products/Commands/Import/ImportProductsCommand.cs @@ -20,7 +20,7 @@ public ImportProductsCommand(string fileName, byte[] data) public string FileName { get; } public byte[] Data { get; } public string CacheKey => ProductCacheKey.GetAllCacheKey; - public CancellationTokenSource? SharedExpiryTokenSource => ProductCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => ProductCacheKey.Tags; } public record CreateProductsTemplateCommand : IRequest> diff --git a/src/Application/Features/Products/Queries/GetAll/GetAllProductsQuery.cs b/src/Application/Features/Products/Queries/GetAll/GetAllProductsQuery.cs index 37cf01bce..63d7e9810 100644 --- a/src/Application/Features/Products/Queries/GetAll/GetAllProductsQuery.cs +++ b/src/Application/Features/Products/Queries/GetAll/GetAllProductsQuery.cs @@ -10,7 +10,7 @@ namespace CleanArchitecture.Blazor.Application.Features.Products.Queries.GetAll; public class GetAllProductsQuery : ICacheableRequest> { public string CacheKey => ProductCacheKey.GetAllCacheKey; - public MemoryCacheEntryOptions? Options => ProductCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => ProductCacheKey.Tags; } public class GetProductQuery : ICacheableRequest @@ -18,7 +18,7 @@ public class GetProductQuery : ICacheableRequest public required int Id { get; set; } public string CacheKey => ProductCacheKey.GetProductByIdCacheKey(Id); - public MemoryCacheEntryOptions? Options => ProductCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => ProductCacheKey.Tags; } public class GetAllProductsQueryHandler : diff --git a/src/Application/Features/Products/Queries/Pagination/ProductsPaginationQuery.cs b/src/Application/Features/Products/Queries/Pagination/ProductsPaginationQuery.cs index 43eeb5045..8cda3e670 100644 --- a/src/Application/Features/Products/Queries/Pagination/ProductsPaginationQuery.cs +++ b/src/Application/Features/Products/Queries/Pagination/ProductsPaginationQuery.cs @@ -14,7 +14,7 @@ public class ProductsWithPaginationQuery : ProductAdvancedFilter, ICacheableRequ public ProductAdvancedSpecification Specification => new(this); public string CacheKey => ProductCacheKey.GetPaginationCacheKey($"{this}"); - public MemoryCacheEntryOptions? Options => ProductCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => ProductCacheKey.Tags; // the currently logged in user public override string ToString() diff --git a/src/Application/Features/Tenants/Caching/TenantCacheKey.cs b/src/Application/Features/Tenants/Caching/TenantCacheKey.cs index 8951e23ac..0c76c7ffb 100644 --- a/src/Application/Features/Tenants/Caching/TenantCacheKey.cs +++ b/src/Application/Features/Tenants/Caching/TenantCacheKey.cs @@ -7,44 +7,14 @@ public static class TenantCacheKey { public const string GetAllCacheKey = "all-Tenants"; public const string TenantsCacheKey = "all-TenantsCacheKey"; - private static readonly TimeSpan RefreshInterval = TimeSpan.FromHours(1); - private static readonly object _tokenLock = new(); - private static CancellationTokenSource _tokenSource = new(RefreshInterval); - - - - public static MemoryCacheEntryOptions MemoryCacheEntryOptions => - new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(GetOrCreateTokenSource().Token)); - public static string GetPaginationCacheKey(string parameters) { return $"TenantsWithPaginationQuery,{parameters}"; } - - public static CancellationTokenSource GetOrCreateTokenSource() - { - lock (_tokenLock) - { - if (_tokenSource.IsCancellationRequested) - { - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - return _tokenSource; - } - } - + public static IEnumerable? Tags => new string[] { "tenant" }; public static void Refresh() { - lock (_tokenLock) - { - if (!_tokenSource.IsCancellationRequested) - { - _tokenSource.Cancel(); - _tokenSource.Dispose(); - _tokenSource = new CancellationTokenSource(RefreshInterval); - } - } + FusionCacheFactory.RemoveByTags(Tags); } - + } \ No newline at end of file diff --git a/src/Application/Features/Tenants/Commands/AddEdit/AddEditTenantCommand.cs b/src/Application/Features/Tenants/Commands/AddEdit/AddEditTenantCommand.cs index 9c9288d02..b2c05be2f 100644 --- a/src/Application/Features/Tenants/Commands/AddEdit/AddEditTenantCommand.cs +++ b/src/Application/Features/Tenants/Commands/AddEdit/AddEditTenantCommand.cs @@ -14,7 +14,7 @@ public class AddEditTenantCommand : ICacheInvalidatorRequest> [Description("Tenant Name")] public string? Name { get; set; } [Description("Description")] public string? Description { get; set; } public string CacheKey => TenantCacheKey.GetAllCacheKey; - public CancellationTokenSource? SharedExpiryTokenSource => TenantCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => TenantCacheKey.Tags; } public class AddEditTenantCommandHandler : IRequestHandler> diff --git a/src/Application/Features/Tenants/Commands/Delete/DeleteTenantCommand.cs b/src/Application/Features/Tenants/Commands/Delete/DeleteTenantCommand.cs index 5e021e8ea..d24862c2d 100644 --- a/src/Application/Features/Tenants/Commands/Delete/DeleteTenantCommand.cs +++ b/src/Application/Features/Tenants/Commands/Delete/DeleteTenantCommand.cs @@ -14,7 +14,7 @@ public DeleteTenantCommand(string[] id) } public string[] Id { get; } public string CacheKey => TenantCacheKey.GetAllCacheKey; - public CancellationTokenSource? SharedExpiryTokenSource => TenantCacheKey.GetOrCreateTokenSource(); + public IEnumerable? Tags => TenantCacheKey.Tags; } public class DeleteTenantCommandHandler : diff --git a/src/Application/Features/Tenants/Queries/GetAll/GetAllTenantsQuery.cs b/src/Application/Features/Tenants/Queries/GetAll/GetAllTenantsQuery.cs index ec7655f23..253b55eb5 100644 --- a/src/Application/Features/Tenants/Queries/GetAll/GetAllTenantsQuery.cs +++ b/src/Application/Features/Tenants/Queries/GetAll/GetAllTenantsQuery.cs @@ -10,7 +10,7 @@ namespace CleanArchitecture.Blazor.Application.Features.Tenants.Queries.GetAll; public class GetAllTenantsQuery : ICacheableRequest> { public string CacheKey => TenantCacheKey.GetAllCacheKey; - public MemoryCacheEntryOptions? Options => TenantCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => TenantCacheKey.Tags; } public class GetAllTenantsQueryHandler : diff --git a/src/Application/Features/Tenants/Queries/Pagination/TenantsPaginationQuery.cs b/src/Application/Features/Tenants/Queries/Pagination/TenantsPaginationQuery.cs index 2f6804e40..2b175db8f 100644 --- a/src/Application/Features/Tenants/Queries/Pagination/TenantsPaginationQuery.cs +++ b/src/Application/Features/Tenants/Queries/Pagination/TenantsPaginationQuery.cs @@ -11,7 +11,7 @@ public class TenantsWithPaginationQuery : PaginationFilter, ICacheableRequest new(this); public string CacheKey => TenantCacheKey.GetPaginationCacheKey($"{this}"); - public MemoryCacheEntryOptions? Options => TenantCacheKey.MemoryCacheEntryOptions; + public IEnumerable? Tags => TenantCacheKey.Tags; public override string ToString() { diff --git a/src/Application/Pipeline/CacheInvalidationBehaviour.cs b/src/Application/Pipeline/CacheInvalidationBehaviour.cs index a1af9026f..dea272327 100644 --- a/src/Application/Pipeline/CacheInvalidationBehaviour.cs +++ b/src/Application/Pipeline/CacheInvalidationBehaviour.cs @@ -1,16 +1,18 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using ZiggyCreatures.Caching.Fusion; + namespace CleanArchitecture.Blazor.Application.Pipeline; public class CacheInvalidationBehaviour : IPipelineBehavior where TRequest : ICacheInvalidatorRequest { - private readonly IAppCache _cache; + private readonly IFusionCache _cache; private readonly ILogger> _logger; public CacheInvalidationBehaviour( - IAppCache cache, + IFusionCache cache, ILogger> logger ) { @@ -28,7 +30,14 @@ public async Task Handle(TRequest request, RequestHandlerDelegate : IPipelineBehavior - where TRequest : IFusionCacheRequest + where TRequest : ICacheableRequest { private readonly IFusionCache _fusionCache; private readonly ILogger> _logger; @@ -26,7 +26,8 @@ public async Task Handle(TRequest request, RequestHandlerDelegate next() + _ => next(), + tags:request.Tags ).ConfigureAwait(false); return response; diff --git a/src/Application/Pipeline/MemoryCacheBehaviour.cs b/src/Application/Pipeline/MemoryCacheBehaviour.cs deleted file mode 100644 index cf1452a5a..000000000 --- a/src/Application/Pipeline/MemoryCacheBehaviour.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace CleanArchitecture.Blazor.Application.Pipeline; - -public class MemoryCacheBehaviour : IPipelineBehavior - where TRequest : ICacheableRequest -{ - private readonly IAppCache _cache; - private readonly ILogger> _logger; - - public MemoryCacheBehaviour( - IAppCache cache, - ILogger> logger - ) - { - _cache = cache; - _logger = logger; - } - - public async Task Handle(TRequest request, RequestHandlerDelegate next, - CancellationToken cancellationToken) - { - _logger.LogTrace("Handling request of type {RequestType} with cache key {CacheKey}", nameof(request), request.CacheKey); - var response = await _cache.GetOrAddAsync( - request.CacheKey, - async () => - await next(), - request.Options).ConfigureAwait(false); - - return response; - } -} \ No newline at end of file diff --git a/src/Application/_Imports.cs b/src/Application/_Imports.cs index 40866bee2..57e2a6fe4 100644 --- a/src/Application/_Imports.cs +++ b/src/Application/_Imports.cs @@ -13,16 +13,14 @@ global using CleanArchitecture.Blazor.Application.Common.Interfaces.Caching; global using CleanArchitecture.Blazor.Application.Common.Models; global using CleanArchitecture.Blazor.Application.Common.Security; +global using CleanArchitecture.Blazor.Application.Common.FusionCache; global using CleanArchitecture.Blazor.Domain.Common.Enums; global using CleanArchitecture.Blazor.Domain.Common.Events; global using CleanArchitecture.Blazor.Domain.Events; global using CleanArchitecture.Blazor.Domain.Entities; global using FluentValidation; -global using LazyCache; global using MediatR; global using MediatR.Pipeline; global using Microsoft.EntityFrameworkCore; -global using Microsoft.Extensions.Caching.Memory; global using Microsoft.Extensions.Localization; -global using Microsoft.Extensions.Logging; -global using Microsoft.Extensions.Primitives; \ No newline at end of file +global using Microsoft.Extensions.Logging; \ No newline at end of file diff --git a/src/Domain/Domain.csproj b/src/Domain/Domain.csproj index 991107142..86ffd1f04 100644 --- a/src/Domain/Domain.csproj +++ b/src/Domain/Domain.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 CleanArchitecture.Blazor.Domain CleanArchitecture.Blazor.Domain enable @@ -11,27 +11,23 @@ - + + - - - - + + + + - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - + diff --git a/src/Infrastructure/Extensions/SerilogExtensions.cs b/src/Infrastructure/Extensions/SerilogExtensions.cs index 586591eaf..2b80afc4a 100644 --- a/src/Infrastructure/Extensions/SerilogExtensions.cs +++ b/src/Infrastructure/Extensions/SerilogExtensions.cs @@ -3,6 +3,7 @@ using System.Data; using CleanArchitecture.Blazor.Infrastructure.Configurations; using CleanArchitecture.Blazor.Infrastructure.Constants.Database; +using DocumentFormat.OpenXml.Spreadsheet; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Configuration; @@ -77,7 +78,7 @@ private static void WriteToDatabase(LoggerConfiguration serilogConfig, IConfigur WriteToNpgsql(serilogConfig, connectionString); break; case DbProviderKeys.SqLite: - WriteToSqLite(serilogConfig, "BlazorDashboardDb.db"); + WriteToSqLite(serilogConfig, "\\BlazorDashboardDb.db"); break; } } @@ -157,7 +158,7 @@ private static void WriteToNpgsql(LoggerConfiguration serilogConfig, string? con { "properties", new PropertiesColumnWriter(NpgsqlDbType.Varchar) }, { "log_event", new LogEventSerializedColumnWriter(NpgsqlDbType.Varchar) }, { "user_name", new SinglePropertyColumnWriter("UserName", PropertyWriteMethod.Raw, NpgsqlDbType.Varchar) }, - { "client_ip", new SinglePropertyColumnWriter("ClientIp", PropertyWriteMethod.Raw, NpgsqlDbType.Varchar) }, + { "client_ip", new SinglePropertyColumnWriter("ClientIP", PropertyWriteMethod.Raw, NpgsqlDbType.Varchar) }, { "client_agent", new SinglePropertyColumnWriter("ClientAgent", PropertyWriteMethod.ToString, NpgsqlDbType.Varchar) @@ -219,7 +220,17 @@ public UserInfoEnricher(IHttpContextAccessor httpContextAccessor) } public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) { - logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty( - "UserName", _httpContextAccessor.HttpContext?.User?.Identity?.Name ?? "")); + var userName = _httpContextAccessor.HttpContext?.User?.Identity?.Name ?? ""; + var headers = _httpContextAccessor.HttpContext?.Request?.Headers; + var clientIp = headers != null && headers.ContainsKey("X-Forwarded-For") + ? headers["X-Forwarded-For"].ToString().Split(',').First().Trim() + : _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString() ?? ""; + var clientAgent = headers != null && headers.ContainsKey("User-Agent") + ? headers["User-Agent"].ToString() + : ""; + + logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("UserName", userName)); + logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("ClientIP", clientIp)); + logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("ClientAgent", clientAgent)); } } \ No newline at end of file diff --git a/src/Infrastructure/Infrastructure.csproj b/src/Infrastructure/Infrastructure.csproj index 116138806..01980e9fd 100644 --- a/src/Infrastructure/Infrastructure.csproj +++ b/src/Infrastructure/Infrastructure.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0 CleanArchitecture.Blazor.Infrastructure CleanArchitecture.Blazor.Infrastructure enable @@ -8,18 +8,17 @@ default - - - - - - + + + + + - - + + diff --git a/src/Infrastructure/Persistence/Configurations/AuditTrailConfiguration.cs b/src/Infrastructure/Persistence/Configurations/AuditTrailConfiguration.cs index 082f9b0ae..46cf10c1c 100644 --- a/src/Infrastructure/Persistence/Configurations/AuditTrailConfiguration.cs +++ b/src/Infrastructure/Persistence/Configurations/AuditTrailConfiguration.cs @@ -18,7 +18,7 @@ public void Configure(EntityTypeBuilder builder) builder.Navigation(e => e.Owner).AutoInclude(); builder.Property(t => t.AuditType) .HasConversion(); - builder.Property(e => e.AffectedColumns).HasStringListConversion(); + builder.Property(e => e.AffectedColumns).HasJsonConversion(); builder.Property(u => u.OldValues).HasJsonConversion(); builder.Property(u => u.NewValues).HasJsonConversion(); builder.Property(u => u.PrimaryKey).HasJsonConversion(); diff --git a/src/Infrastructure/Persistence/Conversions/StringListConverter.cs b/src/Infrastructure/Persistence/Conversions/StringListConverter.cs deleted file mode 100644 index 2bb45a6c1..000000000 --- a/src/Infrastructure/Persistence/Conversions/StringListConverter.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Text.Json; -using CleanArchitecture.Blazor.Application.Common.Interfaces.Serialization; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace CleanArchitecture.Blazor.Infrastructure.Persistence.Conversions; - -public class StringListConverter : ValueConverter, string> -{ - public StringListConverter() : base(v => JsonSerializer.Serialize(v, DefaultJsonSerializerOptions.Options), - v => JsonSerializer.Deserialize>(string.IsNullOrEmpty(v) ? "[]" : v, - DefaultJsonSerializerOptions.Options) ?? new List() - ) - { - } -} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Conversions/ValueConversionExtensions.cs b/src/Infrastructure/Persistence/Conversions/ValueConversionExtensions.cs index 5f93c35ae..ccf54976f 100644 --- a/src/Infrastructure/Persistence/Conversions/ValueConversionExtensions.cs +++ b/src/Infrastructure/Persistence/Conversions/ValueConversionExtensions.cs @@ -10,45 +10,20 @@ public static class ValueConversionExtensions { public static PropertyBuilder HasJsonConversion(this PropertyBuilder propertyBuilder) { + var options = DefaultJsonSerializerOptions.Options; + var converter = new ValueConverter( - v => JsonSerializer.Serialize(v, DefaultJsonSerializerOptions.Options), - v => string.IsNullOrEmpty(v) - ? default - : JsonSerializer.Deserialize(v, DefaultJsonSerializerOptions.Options)); + v => JsonSerializer.Serialize(v, options), + v => string.IsNullOrEmpty(v) ? default : JsonSerializer.Deserialize(v, options)); var comparer = new ValueComparer( - (l, r) => JsonSerializer.Serialize(l, DefaultJsonSerializerOptions.Options) == - JsonSerializer.Serialize(r, DefaultJsonSerializerOptions.Options), - v => v == null ? 0 : JsonSerializer.Serialize(v, DefaultJsonSerializerOptions.Options).GetHashCode(), - v => JsonSerializer.Deserialize(JsonSerializer.Serialize(v, DefaultJsonSerializerOptions.Options), - DefaultJsonSerializerOptions.Options)); + (l, r) => JsonSerializer.Serialize(l, options) == JsonSerializer.Serialize(r, options), + v => v == null ? 0 : JsonSerializer.Serialize(v, options).GetHashCode(), + v => JsonSerializer.Deserialize(JsonSerializer.Serialize(v, options), options)); propertyBuilder.HasConversion(converter); - propertyBuilder.Metadata.SetValueConverter(converter); propertyBuilder.Metadata.SetValueComparer(comparer); - return propertyBuilder; - } - - public static PropertyBuilder> HasStringListConversion( - this PropertyBuilder> propertyBuilder) - { - var converter = new ValueConverter, string>( - v => JsonSerializer.Serialize(v, DefaultJsonSerializerOptions.Options), - v => string.IsNullOrEmpty(v) - ? default - : JsonSerializer.Deserialize>(v, DefaultJsonSerializerOptions.Options)); - - var comparer = new ValueComparer>( - (l, r) => JsonSerializer.Serialize(l, DefaultJsonSerializerOptions.Options) == - JsonSerializer.Serialize(r, DefaultJsonSerializerOptions.Options), - v => v == null ? 0 : JsonSerializer.Serialize(v, DefaultJsonSerializerOptions.Options).GetHashCode(), - v => JsonSerializer.Deserialize>( - JsonSerializer.Serialize(v, DefaultJsonSerializerOptions.Options), - DefaultJsonSerializerOptions.Options)); - propertyBuilder.HasConversion(converter); - propertyBuilder.Metadata.SetValueConverter(converter); - propertyBuilder.Metadata.SetValueComparer(comparer); return propertyBuilder; } } \ No newline at end of file diff --git a/src/Infrastructure/Services/Circuits/UserSessionCircuitHandler.cs b/src/Infrastructure/Services/Circuits/UserSessionCircuitHandler.cs index 21537aa08..6614c2369 100644 --- a/src/Infrastructure/Services/Circuits/UserSessionCircuitHandler.cs +++ b/src/Infrastructure/Services/Circuits/UserSessionCircuitHandler.cs @@ -1,16 +1,17 @@ using CleanArchitecture.Blazor.Application.Features.Fusion; using CleanArchitecture.Blazor.Infrastructure.Extensions; using Microsoft.AspNetCore.Components.Server.Circuits; -using Microsoft.AspNetCore.Http; namespace CleanArchitecture.Blazor.Infrastructure.Services.Circuits; ///

/// Handles user session tracking and online user tracking for Blazor server circuits. /// -public class UserSessionCircuitHandler : CircuitHandler +public class UserSessionCircuitHandler : CircuitHandler,IDisposable { private readonly IServiceProvider _serviceProvider; + private readonly ICurrentUserContextSetter _currentUserContextSetter; + private readonly AuthenticationStateProvider _authenticationStateProvider; /// /// Initializes a new instance of the class. @@ -18,11 +19,37 @@ public class UserSessionCircuitHandler : CircuitHandler /// The user session tracker service. /// The online user tracker service. /// The HTTP context accessor. - public UserSessionCircuitHandler(IServiceProvider serviceProvider) + public UserSessionCircuitHandler(IServiceProvider serviceProvider, ICurrentUserContextSetter currentUserContextSetter, AuthenticationStateProvider authenticationStateProvider) { _serviceProvider = serviceProvider; + _currentUserContextSetter = currentUserContextSetter; + _authenticationStateProvider = authenticationStateProvider; } + public override Task OnCircuitOpenedAsync(Circuit circuit, + CancellationToken cancellationToken) + { + _authenticationStateProvider.AuthenticationStateChanged += + AuthenticationChanged; + + return base.OnCircuitOpenedAsync(circuit, cancellationToken); + } + + private void AuthenticationChanged(Task task) + { + _ = UpdateAuthentication(task); + async Task UpdateAuthentication(Task task) + { + try + { + var state = await task; + _currentUserContextSetter.SetCurrentUser(state.User); + } + catch + { + } + } + } /// /// Called when a new circuit connection is established. /// @@ -31,27 +58,16 @@ public UserSessionCircuitHandler(IServiceProvider serviceProvider) /// A task that represents the asynchronous operation. public override async Task OnConnectionUpAsync(Circuit circuit, CancellationToken cancellationToken) { - var httpContextAccessor = _serviceProvider.GetRequiredService(); + var state = await _authenticationStateProvider.GetAuthenticationStateAsync(); + _currentUserContextSetter.SetCurrentUser(state.User); var usersStateContainer = _serviceProvider.GetRequiredService(); var currentUserContextSetter = _serviceProvider.GetRequiredService(); - var context = httpContextAccessor.HttpContext; - - if (context?.User?.Identity?.IsAuthenticated == true) + if (state.User.Identity?.IsAuthenticated??false) { - var sessionInfo = new SessionInfo - ( - context.User.GetUserId(), - context.User.GetUserName(), - context.User.GetDisplayName(), - context.Connection.RemoteIpAddress?.ToString(), - context.User.GetTenantId(), - context.User.GetProfilePictureDataUrl(), - UserPresence.Available - ); - currentUserContextSetter.SetCurrentUser(sessionInfo); - if (!string.IsNullOrEmpty(sessionInfo.UserId)) + var userId = state.User.GetUserId(); + if (!string.IsNullOrEmpty(userId)) { - usersStateContainer.AddOrUpdate(circuit.Id, sessionInfo.UserId); + usersStateContainer.AddOrUpdate(circuit.Id, userId); } } await base.OnConnectionUpAsync(circuit, cancellationToken); @@ -70,7 +86,7 @@ public override async Task OnConnectionDownAsync(Circuit circuit, CancellationTo var onlineUserTracker = _serviceProvider.GetRequiredService(); var usersStateContainer = _serviceProvider.GetRequiredService(); var currentUserContextSetter = _serviceProvider.GetRequiredService(); - if (currentUserAccessor.SessionInfo!=null) + if (currentUserAccessor.SessionInfo != null) { await userSessionTracker.RemoveAllSessions(currentUserAccessor.SessionInfo.UserId, cancellationToken); await onlineUserTracker.Clear(currentUserAccessor.SessionInfo.UserId, cancellationToken); @@ -80,4 +96,10 @@ public override async Task OnConnectionDownAsync(Circuit circuit, CancellationTo currentUserContextSetter.Clear(); await base.OnConnectionDownAsync(circuit, cancellationToken); } -} + + public void Dispose() + { + _authenticationStateProvider.AuthenticationStateChanged -= + AuthenticationChanged; + } +} \ No newline at end of file diff --git a/src/Infrastructure/Services/Identity/CurrentUserContextSetter.cs b/src/Infrastructure/Services/Identity/CurrentUserContextSetter.cs index b9986da4a..23e97299e 100644 --- a/src/Infrastructure/Services/Identity/CurrentUserContextSetter.cs +++ b/src/Infrastructure/Services/Identity/CurrentUserContextSetter.cs @@ -1,4 +1,6 @@ -namespace CleanArchitecture.Blazor.Infrastructure.Services.Identity; +using CleanArchitecture.Blazor.Infrastructure.Extensions; + +namespace CleanArchitecture.Blazor.Infrastructure.Services.Identity; /// /// Service for setting and clearing the current user context. @@ -19,10 +21,18 @@ public CurrentUserContextSetter(ICurrentUserContext currentUserContext) /// /// Sets the current user context with the provided session information. /// - /// The session information of the current user. - public void SetCurrentUser(SessionInfo sessionInfo) + /// The session information of the current user. + public void SetCurrentUser(ClaimsPrincipal user) { - _currentUserContext.SessionInfo = sessionInfo; + _currentUserContext.SessionInfo = new SessionInfo( + user.GetUserId(), + user.GetUserName(), + user.GetDisplayName(), + "", + user.GetTenantId(), + user.GetProfilePictureDataUrl(), + UserPresence.Available + ); } /// diff --git a/src/Infrastructure/Services/PaddleOCR/DocumentOcrJob.cs b/src/Infrastructure/Services/PaddleOCR/DocumentOcrJob.cs index 20ca4ecc2..5e47a488f 100644 --- a/src/Infrastructure/Services/PaddleOCR/DocumentOcrJob.cs +++ b/src/Infrastructure/Services/PaddleOCR/DocumentOcrJob.cs @@ -131,7 +131,7 @@ public async Task Recognition(int id, CancellationToken cancellationToken) private void CancelCacheToken() { - DocumentCacheKey.GetOrCreateTokenSource().Cancel(); + DocumentCacheKey.Refresh(); } } #pragma warning disable CS8981 diff --git a/src/Migrators/Migrators.MSSQL/Migrators.MSSQL.csproj b/src/Migrators/Migrators.MSSQL/Migrators.MSSQL.csproj index d534cb8aa..461b9c4a4 100644 --- a/src/Migrators/Migrators.MSSQL/Migrators.MSSQL.csproj +++ b/src/Migrators/Migrators.MSSQL/Migrators.MSSQL.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 enable enable CleanArchitecture.Blazor.Migrators.MSSQL diff --git a/src/Migrators/Migrators.PostgreSQL/Migrators.PostgreSQL.csproj b/src/Migrators/Migrators.PostgreSQL/Migrators.PostgreSQL.csproj index 0af4538f0..c1515216c 100644 --- a/src/Migrators/Migrators.PostgreSQL/Migrators.PostgreSQL.csproj +++ b/src/Migrators/Migrators.PostgreSQL/Migrators.PostgreSQL.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 enable enable CleanArchitecture.Blazor.Migrators.PostgreSQL diff --git a/src/Migrators/Migrators.SqLite/Migrations/20230428015135_InitialCreate.Designer.cs b/src/Migrators/Migrators.SqLite/Migrations/20230428015135_InitialCreate.Designer.cs deleted file mode 100644 index 4cce62844..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20230428015135_InitialCreate.Designer.cs +++ /dev/null @@ -1,652 +0,0 @@ -// -using System; -using CleanArchitecture.Blazor.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20230428015135_InitialCreate")] - partial class InitialCreate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "7.0.5"); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Audit.AuditTrail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AffectedColumns") - .HasColumnType("TEXT"); - - b.Property("AuditType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("DateTime") - .HasColumnType("TEXT"); - - b.Property("NewValues") - .HasColumnType("TEXT"); - - b.Property("OldValues") - .HasColumnType("TEXT"); - - b.Property("PrimaryKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TableName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AuditTrails"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Customer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Customers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Content") - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("DocumentType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("IsPublic") - .HasColumnType("INTEGER"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.Property("TenantId") - .HasColumnType("TEXT"); - - b.Property("Title") - .HasColumnType("TEXT"); - - b.Property("URL") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.KeyValue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("KeyValues"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Logger.Logger", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClientAgent") - .HasColumnType("TEXT"); - - b.Property("ClientIP") - .HasColumnType("TEXT"); - - b.Property("Exception") - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .HasColumnType("TEXT"); - - b.Property("Message") - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .HasColumnType("TEXT"); - - b.Property("Properties") - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Loggers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Brand") - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Pictures") - .HasColumnType("TEXT"); - - b.Property("Price") - .HasColumnType("TEXT"); - - b.Property("Unit") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Tenant", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Tenants"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("Group") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("DisplayName") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("IsActive") - .HasColumnType("INTEGER"); - - b.Property("IsLive") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("ProfilePictureDataUrl") - .HasColumnType("text"); - - b.Property("Provider") - .HasColumnType("TEXT"); - - b.Property("RefreshToken") - .HasColumnType("TEXT"); - - b.Property("RefreshTokenExpiryTime") - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("SuperiorId") - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasColumnType("TEXT"); - - b.Property("TenantName") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("SuperiorId"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Audit.AuditTrail", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Owner"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("CreatedBy"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Editor") - .WithMany() - .HasForeignKey("LastModifiedBy"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Editor"); - - b.Navigation("Owner"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("RoleClaims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Superior") - .WithMany() - .HasForeignKey("SuperiorId"); - - b.Navigation("Superior"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("UserRoles") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserRoles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Navigation("RoleClaims"); - - b.Navigation("UserRoles"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Navigation("Logins"); - - b.Navigation("Tokens"); - - b.Navigation("UserClaims"); - - b.Navigation("UserRoles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20230825230709_change_AuditTrail_Id_type_to_guid.Designer.cs b/src/Migrators/Migrators.SqLite/Migrations/20230825230709_change_AuditTrail_Id_type_to_guid.Designer.cs deleted file mode 100644 index 44bc1394d..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20230825230709_change_AuditTrail_Id_type_to_guid.Designer.cs +++ /dev/null @@ -1,642 +0,0 @@ -// -using System; -using CleanArchitecture.Blazor.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20230825230709_change_AuditTrail_Id_type_to_guid")] - partial class change_AuditTrail_Id_type_to_guid - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "7.0.10"); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Audit.AuditTrail", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AffectedColumns") - .HasColumnType("TEXT"); - - b.Property("AuditType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("DateTime") - .HasColumnType("TEXT"); - - b.Property("NewValues") - .HasColumnType("TEXT"); - - b.Property("OldValues") - .HasColumnType("TEXT"); - - b.Property("PrimaryKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TableName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AuditTrails"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Customer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Customers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Content") - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("DocumentType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("IsPublic") - .HasColumnType("INTEGER"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.Property("TenantId") - .HasColumnType("TEXT"); - - b.Property("Title") - .HasColumnType("TEXT"); - - b.Property("URL") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.KeyValue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("KeyValues"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Logger.Logger", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClientAgent") - .HasColumnType("TEXT"); - - b.Property("ClientIP") - .HasColumnType("TEXT"); - - b.Property("Exception") - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .HasColumnType("TEXT"); - - b.Property("Message") - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .HasColumnType("TEXT"); - - b.Property("Properties") - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Loggers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Brand") - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Pictures") - .HasColumnType("TEXT"); - - b.Property("Price") - .HasColumnType("TEXT"); - - b.Property("Unit") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Tenant", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Tenants"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("Group") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("DisplayName") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("IsActive") - .HasColumnType("INTEGER"); - - b.Property("IsLive") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("ProfilePictureDataUrl") - .HasColumnType("text"); - - b.Property("Provider") - .HasColumnType("TEXT"); - - b.Property("RefreshToken") - .HasColumnType("TEXT"); - - b.Property("RefreshTokenExpiryTime") - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("SuperiorId") - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasColumnType("TEXT"); - - b.Property("TenantName") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("SuperiorId"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Audit.AuditTrail", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Owner"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Editor") - .WithMany() - .HasForeignKey("LastModifiedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Editor"); - - b.Navigation("Owner"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("RoleClaims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Superior") - .WithMany() - .HasForeignKey("SuperiorId"); - - b.Navigation("Superior"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("UserRoles") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserRoles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Navigation("RoleClaims"); - - b.Navigation("UserRoles"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Navigation("Logins"); - - b.Navigation("Tokens"); - - b.Navigation("UserClaims"); - - b.Navigation("UserRoles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20230825230709_change_AuditTrail_Id_type_to_guid.cs b/src/Migrators/Migrators.SqLite/Migrations/20230825230709_change_AuditTrail_Id_type_to_guid.cs deleted file mode 100644 index 786c03571..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20230825230709_change_AuditTrail_Id_type_to_guid.cs +++ /dev/null @@ -1,146 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - /// - public partial class change_AuditTrail_Id_type_to_guid : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_AuditTrails_AspNetUsers_UserId", - table: "AuditTrails"); - - migrationBuilder.DropForeignKey( - name: "FK_Documents_AspNetUsers_CreatedBy", - table: "Documents"); - - migrationBuilder.DropForeignKey( - name: "FK_Documents_AspNetUsers_LastModifiedBy", - table: "Documents"); - - migrationBuilder.DropColumn( - name: "Created", - table: "Tenants"); - - migrationBuilder.DropColumn( - name: "CreatedBy", - table: "Tenants"); - - migrationBuilder.DropColumn( - name: "LastModified", - table: "Tenants"); - - migrationBuilder.DropColumn( - name: "LastModifiedBy", - table: "Tenants"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "AuditTrails", - type: "TEXT", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER") - .OldAnnotation("Sqlite:Autoincrement", true); - - migrationBuilder.AddForeignKey( - name: "FK_AuditTrails_AspNetUsers_UserId", - table: "AuditTrails", - column: "UserId", - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.SetNull); - - migrationBuilder.AddForeignKey( - name: "FK_Documents_AspNetUsers_CreatedBy", - table: "Documents", - column: "CreatedBy", - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Documents_AspNetUsers_LastModifiedBy", - table: "Documents", - column: "LastModifiedBy", - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_AuditTrails_AspNetUsers_UserId", - table: "AuditTrails"); - - migrationBuilder.DropForeignKey( - name: "FK_Documents_AspNetUsers_CreatedBy", - table: "Documents"); - - migrationBuilder.DropForeignKey( - name: "FK_Documents_AspNetUsers_LastModifiedBy", - table: "Documents"); - - migrationBuilder.AddColumn( - name: "Created", - table: "Tenants", - type: "TEXT", - nullable: true); - - migrationBuilder.AddColumn( - name: "CreatedBy", - table: "Tenants", - type: "TEXT", - nullable: true); - - migrationBuilder.AddColumn( - name: "LastModified", - table: "Tenants", - type: "TEXT", - nullable: true); - - migrationBuilder.AddColumn( - name: "LastModifiedBy", - table: "Tenants", - type: "TEXT", - nullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "AuditTrails", - type: "INTEGER", - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT") - .Annotation("Sqlite:Autoincrement", true); - - migrationBuilder.AddForeignKey( - name: "FK_AuditTrails_AspNetUsers_UserId", - table: "AuditTrails", - column: "UserId", - principalTable: "AspNetUsers", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_Documents_AspNetUsers_CreatedBy", - table: "Documents", - column: "CreatedBy", - principalTable: "AspNetUsers", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_Documents_AspNetUsers_LastModifiedBy", - table: "Documents", - column: "LastModifiedBy", - principalTable: "AspNetUsers", - principalColumn: "Id"); - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20240413024715_setglobalstringmaxlength.Designer.cs b/src/Migrators/Migrators.SqLite/Migrations/20240413024715_setglobalstringmaxlength.Designer.cs deleted file mode 100644 index fd74528b5..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20240413024715_setglobalstringmaxlength.Designer.cs +++ /dev/null @@ -1,747 +0,0 @@ -// -using System; -using CleanArchitecture.Blazor.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20240413024715_setglobalstringmaxlength")] - partial class setglobalstringmaxlength - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.3"); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AffectedColumns") - .HasColumnType("TEXT"); - - b.Property("AuditType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("DateTime") - .HasColumnType("TEXT"); - - b.Property("NewValues") - .HasColumnType("TEXT"); - - b.Property("OldValues") - .HasColumnType("TEXT"); - - b.Property("PrimaryKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TableName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AuditTrails"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Customer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Customers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Content") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DocumentType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("IsPublic") - .HasColumnType("INTEGER"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Title") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("URL") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.KeyValue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("KeyValues"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Logger", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClientAgent") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClientIP") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Exception") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("Message") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("Properties") - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Exception"); - - b.HasIndex("Level"); - - b.HasIndex("Message"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Loggers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Brand") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Pictures") - .HasColumnType("TEXT"); - - b.Property("Price") - .HasColumnType("TEXT"); - - b.Property("Unit") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Tenant", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Tenants"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Group") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("IsActive") - .HasColumnType("INTEGER"); - - b.Property("IsLive") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("ProfilePictureDataUrl") - .HasMaxLength(450) - .HasColumnType("text"); - - b.Property("Provider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshToken") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshTokenExpiryTime") - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("SuperiorId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TenantName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("SuperiorId"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Owner"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Editor") - .WithMany() - .HasForeignKey("LastModifiedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Editor"); - - b.Navigation("Owner"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("RoleClaims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Superior") - .WithMany() - .HasForeignKey("SuperiorId"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Superior"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("UserRoles") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserRoles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Navigation("RoleClaims"); - - b.Navigation("UserRoles"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Navigation("Logins"); - - b.Navigation("Tokens"); - - b.Navigation("UserClaims"); - - b.Navigation("UserRoles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20240413024715_setglobalstringmaxlength.cs b/src/Migrators/Migrators.SqLite/Migrations/20240413024715_setglobalstringmaxlength.cs deleted file mode 100644 index ac020823e..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20240413024715_setglobalstringmaxlength.cs +++ /dev/null @@ -1,109 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - /// - public partial class setglobalstringmaxlength : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Id", - table: "AuditTrails", - type: "INTEGER", - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT") - .Annotation("Sqlite:Autoincrement", true); - - migrationBuilder.CreateTable( - name: "DataProtectionKeys", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - FriendlyName = table.Column(type: "TEXT", maxLength: 450, nullable: true), - Xml = table.Column(type: "TEXT", maxLength: 4000, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_DataProtectionKeys", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_Loggers_Exception", - table: "Loggers", - column: "Exception"); - - migrationBuilder.CreateIndex( - name: "IX_Loggers_Level", - table: "Loggers", - column: "Level"); - - migrationBuilder.CreateIndex( - name: "IX_Loggers_Message", - table: "Loggers", - column: "Message"); - - migrationBuilder.CreateIndex( - name: "IX_Loggers_TimeStamp", - table: "Loggers", - column: "TimeStamp"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUsers_TenantId", - table: "AspNetUsers", - column: "TenantId"); - - migrationBuilder.AddForeignKey( - name: "FK_AspNetUsers_Tenants_TenantId", - table: "AspNetUsers", - column: "TenantId", - principalTable: "Tenants", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_AspNetUsers_Tenants_TenantId", - table: "AspNetUsers"); - - migrationBuilder.DropTable( - name: "DataProtectionKeys"); - - migrationBuilder.DropIndex( - name: "IX_Loggers_Exception", - table: "Loggers"); - - migrationBuilder.DropIndex( - name: "IX_Loggers_Level", - table: "Loggers"); - - migrationBuilder.DropIndex( - name: "IX_Loggers_Message", - table: "Loggers"); - - migrationBuilder.DropIndex( - name: "IX_Loggers_TimeStamp", - table: "Loggers"); - - migrationBuilder.DropIndex( - name: "IX_AspNetUsers_TenantId", - table: "AspNetUsers"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "AuditTrails", - type: "TEXT", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER") - .OldAnnotation("Sqlite:Autoincrement", true); - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20240503005216_TenantId_ApplicationRole.Designer.cs b/src/Migrators/Migrators.SqLite/Migrations/20240503005216_TenantId_ApplicationRole.Designer.cs deleted file mode 100644 index de3044529..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20240503005216_TenantId_ApplicationRole.Designer.cs +++ /dev/null @@ -1,758 +0,0 @@ -// -using System; -using CleanArchitecture.Blazor.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20240503005216_TenantId_ApplicationRole")] - partial class TenantId_ApplicationRole - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.4"); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AffectedColumns") - .HasColumnType("TEXT"); - - b.Property("AuditType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("DateTime") - .HasColumnType("TEXT"); - - b.Property("NewValues") - .HasColumnType("TEXT"); - - b.Property("OldValues") - .HasColumnType("TEXT"); - - b.Property("PrimaryKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TableName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AuditTrails"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Customer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Customers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Content") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DocumentType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("IsPublic") - .HasColumnType("INTEGER"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Title") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("URL") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.KeyValue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("KeyValues"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Logger", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClientAgent") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClientIP") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Exception") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("Message") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("Properties") - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Exception"); - - b.HasIndex("Level"); - - b.HasIndex("Message"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Loggers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Brand") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Pictures") - .HasColumnType("TEXT"); - - b.Property("Price") - .HasColumnType("TEXT"); - - b.Property("Unit") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Tenant", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Tenants"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Group") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("IsActive") - .HasColumnType("INTEGER"); - - b.Property("IsLive") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("ProfilePictureDataUrl") - .HasMaxLength(450) - .HasColumnType("text"); - - b.Property("Provider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshToken") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshTokenExpiryTime") - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("SuperiorId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("SuperiorId"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Owner"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Editor") - .WithMany() - .HasForeignKey("LastModifiedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Editor"); - - b.Navigation("Owner"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("RoleClaims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Superior") - .WithMany() - .HasForeignKey("SuperiorId"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Superior"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("UserRoles") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserRoles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Navigation("RoleClaims"); - - b.Navigation("UserRoles"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Navigation("Logins"); - - b.Navigation("Tokens"); - - b.Navigation("UserClaims"); - - b.Navigation("UserRoles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20240503005216_TenantId_ApplicationRole.cs b/src/Migrators/Migrators.SqLite/Migrations/20240503005216_TenantId_ApplicationRole.cs deleted file mode 100644 index 967ec2db2..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20240503005216_TenantId_ApplicationRole.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - /// - public partial class TenantId_ApplicationRole : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "TenantName", - table: "AspNetUsers"); - - migrationBuilder.AddColumn( - name: "TenantId", - table: "AspNetRoles", - type: "TEXT", - maxLength: 450, - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_AspNetRoles_TenantId", - table: "AspNetRoles", - column: "TenantId"); - - migrationBuilder.AddForeignKey( - name: "FK_AspNetRoles_Tenants_TenantId", - table: "AspNetRoles", - column: "TenantId", - principalTable: "Tenants", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_AspNetRoles_Tenants_TenantId", - table: "AspNetRoles"); - - migrationBuilder.DropIndex( - name: "IX_AspNetRoles_TenantId", - table: "AspNetRoles"); - - migrationBuilder.DropColumn( - name: "TenantId", - table: "AspNetRoles"); - - migrationBuilder.AddColumn( - name: "TenantName", - table: "AspNetUsers", - type: "TEXT", - maxLength: 450, - nullable: true); - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20240910104003_picklist_index.Designer.cs b/src/Migrators/Migrators.SqLite/Migrations/20240910104003_picklist_index.Designer.cs deleted file mode 100644 index bfe4ef70b..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20240910104003_picklist_index.Designer.cs +++ /dev/null @@ -1,774 +0,0 @@ -// -using System; -using CleanArchitecture.Blazor.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20240910104003_picklist_index")] - partial class picklist_index - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.8"); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AffectedColumns") - .HasColumnType("TEXT"); - - b.Property("AuditType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("DateTime") - .HasColumnType("TEXT"); - - b.Property("NewValues") - .HasColumnType("TEXT"); - - b.Property("OldValues") - .HasColumnType("TEXT"); - - b.Property("PrimaryKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TableName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AuditTrails"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Country") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Content") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DocumentType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("IsPublic") - .HasColumnType("INTEGER"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Title") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("URL") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.KeyValue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("TEXT"); - - b.Property("Text") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name", "Value") - .IsUnique(); - - b.ToTable("KeyValues"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Logger", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClientAgent") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClientIP") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Exception") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("Message") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("Properties") - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Exception"); - - b.HasIndex("Level"); - - b.HasIndex("Message"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Loggers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Brand") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Pictures") - .HasColumnType("TEXT"); - - b.Property("Price") - .HasColumnType("TEXT"); - - b.Property("Unit") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Tenant", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Tenants"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Group") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("IsActive") - .HasColumnType("INTEGER"); - - b.Property("IsLive") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("ProfilePictureDataUrl") - .HasMaxLength(450) - .HasColumnType("text"); - - b.Property("Provider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshToken") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshTokenExpiryTime") - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("SuperiorId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("SuperiorId"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Owner"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Editor") - .WithMany() - .HasForeignKey("LastModifiedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Editor"); - - b.Navigation("Owner"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("RoleClaims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Superior") - .WithMany() - .HasForeignKey("SuperiorId"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Superior"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("UserRoles") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserRoles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Navigation("RoleClaims"); - - b.Navigation("UserRoles"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Navigation("Logins"); - - b.Navigation("Tokens"); - - b.Navigation("UserClaims"); - - b.Navigation("UserRoles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20240910104003_picklist_index.cs b/src/Migrators/Migrators.SqLite/Migrations/20240910104003_picklist_index.cs deleted file mode 100644 index dc87f6d72..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20240910104003_picklist_index.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - /// - public partial class picklist_index : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Customers"); - - migrationBuilder.CreateTable( - name: "Contacts", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", maxLength: 50, nullable: false), - Description = table.Column(type: "TEXT", maxLength: 450, nullable: true), - Email = table.Column(type: "TEXT", maxLength: 450, nullable: true), - PhoneNumber = table.Column(type: "TEXT", maxLength: 450, nullable: true), - Country = table.Column(type: "TEXT", maxLength: 450, nullable: true), - Created = table.Column(type: "TEXT", nullable: true), - CreatedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), - LastModified = table.Column(type: "TEXT", nullable: true), - LastModifiedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Contacts", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_KeyValues_Name_Value", - table: "KeyValues", - columns: new[] { "Name", "Value" }, - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Contacts"); - - migrationBuilder.DropIndex( - name: "IX_KeyValues_Name_Value", - table: "KeyValues"); - - migrationBuilder.CreateTable( - name: "Customers", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Created = table.Column(type: "TEXT", nullable: true), - CreatedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), - Description = table.Column(type: "TEXT", maxLength: 450, nullable: true), - LastModified = table.Column(type: "TEXT", nullable: true), - LastModifiedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), - Name = table.Column(type: "TEXT", maxLength: 50, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Customers", x => x.Id); - }); - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20240925113215_Logger_Index.Designer.cs b/src/Migrators/Migrators.SqLite/Migrations/20240925113215_Logger_Index.Designer.cs deleted file mode 100644 index fe499e471..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20240925113215_Logger_Index.Designer.cs +++ /dev/null @@ -1,774 +0,0 @@ -// -using System; -using CleanArchitecture.Blazor.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20240925113215_Logger_Index")] - partial class Logger_Index - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.8"); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AffectedColumns") - .HasColumnType("TEXT"); - - b.Property("AuditType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("DateTime") - .HasColumnType("TEXT"); - - b.Property("NewValues") - .HasColumnType("TEXT"); - - b.Property("OldValues") - .HasColumnType("TEXT"); - - b.Property("PrimaryKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TableName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AuditTrails"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Country") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Content") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DocumentType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("IsPublic") - .HasColumnType("INTEGER"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Title") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("URL") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.KeyValue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("TEXT"); - - b.Property("Text") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name", "Value") - .IsUnique(); - - b.ToTable("KeyValues"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Logger", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClientAgent") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClientIP") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Exception") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Message") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Properties") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Level"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Loggers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Brand") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("TEXT"); - - b.Property("Pictures") - .HasColumnType("TEXT"); - - b.Property("Price") - .HasColumnType("TEXT"); - - b.Property("Unit") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Tenant", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Tenants"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Group") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("IsActive") - .HasColumnType("INTEGER"); - - b.Property("IsLive") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("ProfilePictureDataUrl") - .HasMaxLength(450) - .HasColumnType("text"); - - b.Property("Provider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshToken") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshTokenExpiryTime") - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("SuperiorId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("SuperiorId"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Owner"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "LastModifier") - .WithMany() - .HasForeignKey("LastModifiedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("LastModifier"); - - b.Navigation("Owner"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("RoleClaims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Superior") - .WithMany() - .HasForeignKey("SuperiorId"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Superior"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("UserRoles") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserRoles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Navigation("RoleClaims"); - - b.Navigation("UserRoles"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Navigation("Logins"); - - b.Navigation("Tokens"); - - b.Navigation("UserClaims"); - - b.Navigation("UserRoles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20240925113215_Logger_Index.cs b/src/Migrators/Migrators.SqLite/Migrations/20240925113215_Logger_Index.cs deleted file mode 100644 index c22f562fd..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20240925113215_Logger_Index.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - /// - public partial class Logger_Index : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_Loggers_Exception", - table: "Loggers"); - - migrationBuilder.DropIndex( - name: "IX_Loggers_Message", - table: "Loggers"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "Products", - type: "TEXT", - maxLength: 80, - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 450, - oldNullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Products_Name", - table: "Products", - column: "Name", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_Products_Name", - table: "Products"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "Products", - type: "TEXT", - maxLength: 450, - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 80); - - migrationBuilder.CreateIndex( - name: "IX_Loggers_Exception", - table: "Loggers", - column: "Exception"); - - migrationBuilder.CreateIndex( - name: "IX_Loggers_Message", - table: "Loggers", - column: "Message"); - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20240929114909_rename_picklist.Designer.cs b/src/Migrators/Migrators.SqLite/Migrations/20240929114909_rename_picklist.Designer.cs deleted file mode 100644 index 0129019f5..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20240929114909_rename_picklist.Designer.cs +++ /dev/null @@ -1,774 +0,0 @@ -// -using System; -using CleanArchitecture.Blazor.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20240929114909_rename_picklist")] - partial class rename_picklist - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.8"); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AffectedColumns") - .HasColumnType("TEXT"); - - b.Property("AuditType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("DateTime") - .HasColumnType("TEXT"); - - b.Property("NewValues") - .HasColumnType("TEXT"); - - b.Property("OldValues") - .HasColumnType("TEXT"); - - b.Property("PrimaryKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TableName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AuditTrails"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Country") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Content") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DocumentType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("IsPublic") - .HasColumnType("INTEGER"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Title") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("URL") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Logger", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClientAgent") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClientIP") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Exception") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Message") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Properties") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Level"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Loggers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.PicklistSet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("TEXT"); - - b.Property("Text") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name", "Value") - .IsUnique(); - - b.ToTable("PicklistSets"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Brand") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("TEXT"); - - b.Property("Pictures") - .HasColumnType("TEXT"); - - b.Property("Price") - .HasColumnType("TEXT"); - - b.Property("Unit") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Tenant", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Tenants"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Group") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("IsActive") - .HasColumnType("INTEGER"); - - b.Property("IsLive") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("ProfilePictureDataUrl") - .HasMaxLength(450) - .HasColumnType("text"); - - b.Property("Provider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshToken") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshTokenExpiryTime") - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("SuperiorId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("SuperiorId"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Owner"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "LastModifier") - .WithMany() - .HasForeignKey("LastModifiedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("LastModifier"); - - b.Navigation("Owner"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("RoleClaims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Superior") - .WithMany() - .HasForeignKey("SuperiorId"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Superior"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("UserRoles") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserRoles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Navigation("RoleClaims"); - - b.Navigation("UserRoles"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Navigation("Logins"); - - b.Navigation("Tokens"); - - b.Navigation("UserClaims"); - - b.Navigation("UserRoles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20240929114909_rename_picklist.cs b/src/Migrators/Migrators.SqLite/Migrations/20240929114909_rename_picklist.cs deleted file mode 100644 index bc357d109..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20240929114909_rename_picklist.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - /// - public partial class rename_picklist : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "KeyValues"); - - migrationBuilder.CreateTable( - name: "PicklistSets", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", maxLength: 30, nullable: false), - Value = table.Column(type: "TEXT", maxLength: 50, nullable: true), - Text = table.Column(type: "TEXT", maxLength: 100, nullable: true), - Description = table.Column(type: "TEXT", maxLength: 255, nullable: true), - Created = table.Column(type: "TEXT", nullable: true), - CreatedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), - LastModified = table.Column(type: "TEXT", nullable: true), - LastModifiedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_PicklistSets", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_PicklistSets_Name_Value", - table: "PicklistSets", - columns: new[] { "Name", "Value" }, - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "PicklistSets"); - - migrationBuilder.CreateTable( - name: "KeyValues", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Created = table.Column(type: "TEXT", nullable: true), - CreatedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), - Description = table.Column(type: "TEXT", maxLength: 255, nullable: true), - LastModified = table.Column(type: "TEXT", nullable: true), - LastModifiedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), - Name = table.Column(type: "TEXT", maxLength: 30, nullable: false), - Text = table.Column(type: "TEXT", maxLength: 100, nullable: true), - Value = table.Column(type: "TEXT", maxLength: 50, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_KeyValues", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_KeyValues_Name_Value", - table: "KeyValues", - columns: new[] { "Name", "Value" }, - unique: true); - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20241007113815_TimeZoneId_LanguageCode.Designer.cs b/src/Migrators/Migrators.SqLite/Migrations/20241007113815_TimeZoneId_LanguageCode.Designer.cs deleted file mode 100644 index 0395f9850..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20241007113815_TimeZoneId_LanguageCode.Designer.cs +++ /dev/null @@ -1,810 +0,0 @@ -// -using System; -using CleanArchitecture.Blazor.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20241007113815_TimeZoneId_LanguageCode")] - partial class TimeZoneId_LanguageCode - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.8"); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AffectedColumns") - .HasColumnType("TEXT"); - - b.Property("AuditType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("DateTime") - .HasColumnType("TEXT"); - - b.Property("NewValues") - .HasColumnType("TEXT"); - - b.Property("OldValues") - .HasColumnType("TEXT"); - - b.Property("PrimaryKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TableName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AuditTrails"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Country") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Content") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DocumentType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("IsPublic") - .HasColumnType("INTEGER"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Title") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("URL") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Logger", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClientAgent") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClientIP") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Exception") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Message") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Properties") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Level"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Loggers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.PicklistSet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("TEXT"); - - b.Property("Text") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name", "Value") - .IsUnique(); - - b.ToTable("PicklistSets"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Brand") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("TEXT"); - - b.Property("Pictures") - .HasColumnType("TEXT"); - - b.Property("Price") - .HasColumnType("TEXT"); - - b.Property("Unit") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Tenant", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Tenants"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Group") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("IsActive") - .HasColumnType("INTEGER"); - - b.Property("IsLive") - .HasColumnType("INTEGER"); - - b.Property("LanguageCode") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("ProfilePictureDataUrl") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Provider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshToken") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshTokenExpiryTime") - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("SuperiorId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TimeZoneId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("SuperiorId"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Owner"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "LastModifier") - .WithMany() - .HasForeignKey("LastModifiedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("LastModifier"); - - b.Navigation("Owner"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("RoleClaims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Superior") - .WithMany() - .HasForeignKey("SuperiorId"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Superior"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("UserRoles") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserRoles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Navigation("RoleClaims"); - - b.Navigation("UserRoles"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Navigation("Logins"); - - b.Navigation("Tokens"); - - b.Navigation("UserClaims"); - - b.Navigation("UserRoles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20241007113815_TimeZoneId_LanguageCode.cs b/src/Migrators/Migrators.SqLite/Migrations/20241007113815_TimeZoneId_LanguageCode.cs deleted file mode 100644 index d47b3e882..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20241007113815_TimeZoneId_LanguageCode.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - /// - public partial class TimeZoneId_LanguageCode : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "ProfilePictureDataUrl", - table: "AspNetUsers", - type: "TEXT", - maxLength: 450, - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldMaxLength: 450, - oldNullable: true); - - migrationBuilder.AddColumn( - name: "Created", - table: "AspNetUsers", - type: "TEXT", - nullable: true); - - migrationBuilder.AddColumn( - name: "CreatedBy", - table: "AspNetUsers", - type: "TEXT", - maxLength: 450, - nullable: true); - - migrationBuilder.AddColumn( - name: "LanguageCode", - table: "AspNetUsers", - type: "TEXT", - maxLength: 450, - nullable: true); - - migrationBuilder.AddColumn( - name: "LastModified", - table: "AspNetUsers", - type: "TEXT", - nullable: true); - - migrationBuilder.AddColumn( - name: "LastModifiedBy", - table: "AspNetUsers", - type: "TEXT", - maxLength: 450, - nullable: true); - - migrationBuilder.AddColumn( - name: "TimeZoneId", - table: "AspNetUsers", - type: "TEXT", - maxLength: 450, - nullable: true); - - migrationBuilder.AddColumn( - name: "Created", - table: "AspNetRoles", - type: "TEXT", - nullable: true); - - migrationBuilder.AddColumn( - name: "CreatedBy", - table: "AspNetRoles", - type: "TEXT", - maxLength: 450, - nullable: true); - - migrationBuilder.AddColumn( - name: "LastModified", - table: "AspNetRoles", - type: "TEXT", - nullable: true); - - migrationBuilder.AddColumn( - name: "LastModifiedBy", - table: "AspNetRoles", - type: "TEXT", - maxLength: 450, - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Created", - table: "AspNetUsers"); - - migrationBuilder.DropColumn( - name: "CreatedBy", - table: "AspNetUsers"); - - migrationBuilder.DropColumn( - name: "LanguageCode", - table: "AspNetUsers"); - - migrationBuilder.DropColumn( - name: "LastModified", - table: "AspNetUsers"); - - migrationBuilder.DropColumn( - name: "LastModifiedBy", - table: "AspNetUsers"); - - migrationBuilder.DropColumn( - name: "TimeZoneId", - table: "AspNetUsers"); - - migrationBuilder.DropColumn( - name: "Created", - table: "AspNetRoles"); - - migrationBuilder.DropColumn( - name: "CreatedBy", - table: "AspNetRoles"); - - migrationBuilder.DropColumn( - name: "LastModified", - table: "AspNetRoles"); - - migrationBuilder.DropColumn( - name: "LastModifiedBy", - table: "AspNetRoles"); - - migrationBuilder.AlterColumn( - name: "ProfilePictureDataUrl", - table: "AspNetUsers", - type: "text", - maxLength: 450, - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 450, - oldNullable: true); - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20241013032543_CreatedByUser_ApplicationUser.Designer.cs b/src/Migrators/Migrators.SqLite/Migrations/20241013032543_CreatedByUser_ApplicationUser.Designer.cs deleted file mode 100644 index 9b8ea159b..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20241013032543_CreatedByUser_ApplicationUser.Designer.cs +++ /dev/null @@ -1,826 +0,0 @@ -// -using System; -using CleanArchitecture.Blazor.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20241013032543_CreatedByUser_ApplicationUser")] - partial class CreatedByUser_ApplicationUser - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AffectedColumns") - .HasColumnType("TEXT"); - - b.Property("AuditType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("DateTime") - .HasColumnType("TEXT"); - - b.Property("NewValues") - .HasColumnType("TEXT"); - - b.Property("OldValues") - .HasColumnType("TEXT"); - - b.Property("PrimaryKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TableName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AuditTrails"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Country") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Content") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DocumentType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("IsPublic") - .HasColumnType("INTEGER"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Title") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("URL") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Logger", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClientAgent") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClientIP") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Exception") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Message") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Properties") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Level"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Loggers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.PicklistSet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("TEXT"); - - b.Property("Text") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name", "Value") - .IsUnique(); - - b.ToTable("PicklistSets"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Brand") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("TEXT"); - - b.Property("Pictures") - .HasColumnType("TEXT"); - - b.Property("Price") - .HasColumnType("TEXT"); - - b.Property("Unit") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Tenant", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Tenants"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Group") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("IsActive") - .HasColumnType("INTEGER"); - - b.Property("IsLive") - .HasColumnType("INTEGER"); - - b.Property("LanguageCode") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("ProfilePictureDataUrl") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Provider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshToken") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshTokenExpiryTime") - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("SuperiorId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TimeZoneId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("SuperiorId"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Owner"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "LastModifier") - .WithMany() - .HasForeignKey("LastModifiedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("LastModifier"); - - b.Navigation("Owner"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("RoleClaims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "CreatedByUser") - .WithMany() - .HasForeignKey("CreatedBy"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "LastModifiedByUser") - .WithMany() - .HasForeignKey("LastModifiedBy"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Superior") - .WithMany() - .HasForeignKey("SuperiorId"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("CreatedByUser"); - - b.Navigation("LastModifiedByUser"); - - b.Navigation("Superior"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("UserRoles") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserRoles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Navigation("RoleClaims"); - - b.Navigation("UserRoles"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Navigation("Logins"); - - b.Navigation("Tokens"); - - b.Navigation("UserClaims"); - - b.Navigation("UserRoles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20241013032543_CreatedByUser_ApplicationUser.cs b/src/Migrators/Migrators.SqLite/Migrations/20241013032543_CreatedByUser_ApplicationUser.cs deleted file mode 100644 index 0c09e7851..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20241013032543_CreatedByUser_ApplicationUser.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - /// - public partial class CreatedByUser_ApplicationUser : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateIndex( - name: "IX_AspNetUsers_CreatedBy", - table: "AspNetUsers", - column: "CreatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUsers_LastModifiedBy", - table: "AspNetUsers", - column: "LastModifiedBy"); - - migrationBuilder.AddForeignKey( - name: "FK_AspNetUsers_AspNetUsers_CreatedBy", - table: "AspNetUsers", - column: "CreatedBy", - principalTable: "AspNetUsers", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_AspNetUsers_AspNetUsers_LastModifiedBy", - table: "AspNetUsers", - column: "LastModifiedBy", - principalTable: "AspNetUsers", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_AspNetUsers_AspNetUsers_CreatedBy", - table: "AspNetUsers"); - - migrationBuilder.DropForeignKey( - name: "FK_AspNetUsers_AspNetUsers_LastModifiedBy", - table: "AspNetUsers"); - - migrationBuilder.DropIndex( - name: "IX_AspNetUsers_CreatedBy", - table: "AspNetUsers"); - - migrationBuilder.DropIndex( - name: "IX_AspNetUsers_LastModifiedBy", - table: "AspNetUsers"); - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20241015103124_ApplicationRole_Name_Index.Designer.cs b/src/Migrators/Migrators.SqLite/Migrations/20241015103124_ApplicationRole_Name_Index.Designer.cs deleted file mode 100644 index 10a758ee0..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20241015103124_ApplicationRole_Name_Index.Designer.cs +++ /dev/null @@ -1,826 +0,0 @@ -// -using System; -using CleanArchitecture.Blazor.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20241015103124_ApplicationRole_Name_Index")] - partial class ApplicationRole_Name_Index - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AffectedColumns") - .HasColumnType("TEXT"); - - b.Property("AuditType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("DateTime") - .HasColumnType("TEXT"); - - b.Property("NewValues") - .HasColumnType("TEXT"); - - b.Property("OldValues") - .HasColumnType("TEXT"); - - b.Property("PrimaryKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TableName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AuditTrails"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Contact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Country") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Contacts"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Content") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DocumentType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("IsPublic") - .HasColumnType("INTEGER"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Title") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("URL") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Documents"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Logger", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClientAgent") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClientIP") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Exception") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Message") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("Properties") - .HasMaxLength(2147483647) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Level"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Loggers"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.PicklistSet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("TEXT"); - - b.Property("Text") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name", "Value") - .IsUnique(); - - b.ToTable("PicklistSets"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Brand") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("TEXT"); - - b.Property("Pictures") - .HasColumnType("TEXT"); - - b.Property("Price") - .HasColumnType("TEXT"); - - b.Property("Unit") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Tenant", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Tenants"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .HasDatabaseName("RoleNameIndex"); - - b.HasIndex("TenantId", "Name") - .IsUnique(); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Group") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("DisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("IsActive") - .HasColumnType("INTEGER"); - - b.Property("IsLive") - .HasColumnType("INTEGER"); - - b.Property("LanguageCode") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LastModified") - .HasColumnType("TEXT"); - - b.Property("LastModifiedBy") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("ProfilePictureDataUrl") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Provider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshToken") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RefreshTokenExpiryTime") - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("SuperiorId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TenantId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TimeZoneId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("SuperiorId"); - - b.HasIndex("TenantId"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasMaxLength(450) - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasMaxLength(4000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Owner") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Owner"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.Document", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "CreatedByUser") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "LastModifiedByUser") - .WithMany() - .HasForeignKey("LastModifiedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("CreatedByUser"); - - b.Navigation("LastModifiedByUser"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRoleClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("RoleClaims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "CreatedByUser") - .WithMany() - .HasForeignKey("CreatedBy"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "LastModifiedByUser") - .WithMany() - .HasForeignKey("LastModifiedBy"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "Superior") - .WithMany() - .HasForeignKey("SuperiorId"); - - b.HasOne("CleanArchitecture.Blazor.Domain.Entities.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("CreatedByUser"); - - b.Navigation("LastModifiedByUser"); - - b.Navigation("Superior"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserClaim", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserLogin", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserRole", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", "Role") - .WithMany("UserRoles") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("UserRoles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUserToken", b => - { - b.HasOne("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", "User") - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationRole", b => - { - b.Navigation("RoleClaims"); - - b.Navigation("UserRoles"); - }); - - modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Identity.ApplicationUser", b => - { - b.Navigation("Logins"); - - b.Navigation("Tokens"); - - b.Navigation("UserClaims"); - - b.Navigation("UserRoles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20241015103124_ApplicationRole_Name_Index.cs b/src/Migrators/Migrators.SqLite/Migrations/20241015103124_ApplicationRole_Name_Index.cs deleted file mode 100644 index e9bbcd012..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20241015103124_ApplicationRole_Name_Index.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - /// - public partial class ApplicationRole_Name_Index : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_AspNetRoles_TenantId", - table: "AspNetRoles"); - - migrationBuilder.DropIndex( - name: "RoleNameIndex", - table: "AspNetRoles"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetRoles_TenantId_Name", - table: "AspNetRoles", - columns: new[] { "TenantId", "Name" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "AspNetRoles", - column: "NormalizedName"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_AspNetRoles_TenantId_Name", - table: "AspNetRoles"); - - migrationBuilder.DropIndex( - name: "RoleNameIndex", - table: "AspNetRoles"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetRoles_TenantId", - table: "AspNetRoles", - column: "TenantId"); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "AspNetRoles", - column: "NormalizedName", - unique: true); - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20241108055808_DebugView_AuditTrail.cs b/src/Migrators/Migrators.SqLite/Migrations/20241108055808_DebugView_AuditTrail.cs deleted file mode 100644 index 222e96e99..000000000 --- a/src/Migrators/Migrators.SqLite/Migrations/20241108055808_DebugView_AuditTrail.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations -{ - /// - public partial class DebugView_AuditTrail : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "DebugView", - table: "AuditTrails", - type: "TEXT", - maxLength: 2147483647, - nullable: true); - - migrationBuilder.AddColumn( - name: "ErrorMessage", - table: "AuditTrails", - type: "TEXT", - maxLength: 2147483647, - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "DebugView", - table: "AuditTrails"); - - migrationBuilder.DropColumn( - name: "ErrorMessage", - table: "AuditTrails"); - } - } -} diff --git a/src/Migrators/Migrators.SqLite/Migrations/20241108055808_DebugView_AuditTrail.Designer.cs b/src/Migrators/Migrators.SqLite/Migrations/20241111125832_initialCreate.Designer.cs similarity index 99% rename from src/Migrators/Migrators.SqLite/Migrations/20241108055808_DebugView_AuditTrail.Designer.cs rename to src/Migrators/Migrators.SqLite/Migrations/20241111125832_initialCreate.Designer.cs index 052c367a3..aa076346a 100644 --- a/src/Migrators/Migrators.SqLite/Migrations/20241108055808_DebugView_AuditTrail.Designer.cs +++ b/src/Migrators/Migrators.SqLite/Migrations/20241111125832_initialCreate.Designer.cs @@ -11,14 +11,14 @@ namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20241108055808_DebugView_AuditTrail")] - partial class DebugView_AuditTrail + [Migration("20241111125832_initialCreate")] + partial class initialCreate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); + modelBuilder.HasAnnotation("ProductVersion", "9.0.0-rc.2.24474.1"); modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => { diff --git a/src/Migrators/Migrators.SqLite/Migrations/20230428015135_InitialCreate.cs b/src/Migrators/Migrators.SqLite/Migrations/20241111125832_initialCreate.cs similarity index 68% rename from src/Migrators/Migrators.SqLite/Migrations/20230428015135_InitialCreate.cs rename to src/Migrators/Migrators.SqLite/Migrations/20241111125832_initialCreate.cs index 7f2fb650d..82184b450 100644 --- a/src/Migrators/Migrators.SqLite/Migrations/20230428015135_InitialCreate.cs +++ b/src/Migrators/Migrators.SqLite/Migrations/20241111125832_initialCreate.cs @@ -6,163 +6,206 @@ namespace CleanArchitecture.Blazor.Migrators.SqLite.Migrations { /// - public partial class InitialCreate : Migration + public partial class initialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( - name: "AspNetRoles", + name: "Contacts", columns: table => new { - Id = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: true), - Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", maxLength: 50, nullable: false), + Description = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Email = table.Column(type: "TEXT", maxLength: 450, nullable: true), + PhoneNumber = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Country = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Created = table.Column(type: "TEXT", nullable: true), + CreatedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), + LastModified = table.Column(type: "TEXT", nullable: true), + LastModifiedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true) }, constraints: table => { - table.PrimaryKey("PK_AspNetRoles", x => x.Id); + table.PrimaryKey("PK_Contacts", x => x.Id); }); migrationBuilder.CreateTable( - name: "AspNetUsers", + name: "DataProtectionKeys", columns: table => new { - Id = table.Column(type: "TEXT", nullable: false), - DisplayName = table.Column(type: "TEXT", nullable: true), - Provider = table.Column(type: "TEXT", nullable: true), - TenantId = table.Column(type: "TEXT", nullable: true), - TenantName = table.Column(type: "TEXT", nullable: true), - ProfilePictureDataUrl = table.Column(type: "text", nullable: true), - IsActive = table.Column(type: "INTEGER", nullable: false), - IsLive = table.Column(type: "INTEGER", nullable: false), - RefreshToken = table.Column(type: "TEXT", nullable: true), - RefreshTokenExpiryTime = table.Column(type: "TEXT", nullable: false), - SuperiorId = table.Column(type: "TEXT", nullable: true), - UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "INTEGER", nullable: false), - PasswordHash = table.Column(type: "TEXT", nullable: true), - SecurityStamp = table.Column(type: "TEXT", nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), - PhoneNumber = table.Column(type: "TEXT", nullable: true), - PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), - TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), - LockoutEnd = table.Column(type: "TEXT", nullable: true), - LockoutEnabled = table.Column(type: "INTEGER", nullable: false), - AccessFailedCount = table.Column(type: "INTEGER", nullable: false) + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + FriendlyName = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Xml = table.Column(type: "TEXT", maxLength: 4000, nullable: true) }, constraints: table => { - table.PrimaryKey("PK_AspNetUsers", x => x.Id); - table.ForeignKey( - name: "FK_AspNetUsers_AspNetUsers_SuperiorId", - column: x => x.SuperiorId, - principalTable: "AspNetUsers", - principalColumn: "Id"); + table.PrimaryKey("PK_DataProtectionKeys", x => x.Id); }); migrationBuilder.CreateTable( - name: "Customers", + name: "Loggers", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", maxLength: 50, nullable: false), - Description = table.Column(type: "TEXT", nullable: true), - Created = table.Column(type: "TEXT", nullable: true), - CreatedBy = table.Column(type: "TEXT", nullable: true), - LastModified = table.Column(type: "TEXT", nullable: true), - LastModifiedBy = table.Column(type: "TEXT", nullable: true) + Message = table.Column(type: "TEXT", maxLength: 2147483647, nullable: true), + MessageTemplate = table.Column(type: "TEXT", maxLength: 2147483647, nullable: true), + Level = table.Column(type: "TEXT", maxLength: 450, nullable: false), + TimeStamp = table.Column(type: "TEXT", nullable: false), + Exception = table.Column(type: "TEXT", maxLength: 2147483647, nullable: true), + UserName = table.Column(type: "TEXT", maxLength: 450, nullable: true), + ClientIP = table.Column(type: "TEXT", maxLength: 450, nullable: true), + ClientAgent = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Properties = table.Column(type: "TEXT", maxLength: 2147483647, nullable: true), + LogEvent = table.Column(type: "TEXT", maxLength: 2147483647, nullable: true) }, constraints: table => { - table.PrimaryKey("PK_Customers", x => x.Id); + table.PrimaryKey("PK_Loggers", x => x.Id); }); migrationBuilder.CreateTable( - name: "KeyValues", + name: "PicklistSets", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - Value = table.Column(type: "TEXT", nullable: true), - Text = table.Column(type: "TEXT", nullable: true), - Description = table.Column(type: "TEXT", nullable: true), + Name = table.Column(type: "TEXT", maxLength: 30, nullable: false), + Value = table.Column(type: "TEXT", maxLength: 50, nullable: true), + Text = table.Column(type: "TEXT", maxLength: 100, nullable: true), + Description = table.Column(type: "TEXT", maxLength: 255, nullable: true), Created = table.Column(type: "TEXT", nullable: true), - CreatedBy = table.Column(type: "TEXT", nullable: true), + CreatedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), LastModified = table.Column(type: "TEXT", nullable: true), - LastModifiedBy = table.Column(type: "TEXT", nullable: true) + LastModifiedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true) }, constraints: table => { - table.PrimaryKey("PK_KeyValues", x => x.Id); + table.PrimaryKey("PK_PicklistSets", x => x.Id); }); migrationBuilder.CreateTable( - name: "Loggers", + name: "Products", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), - Message = table.Column(type: "TEXT", nullable: true), - MessageTemplate = table.Column(type: "TEXT", nullable: true), - Level = table.Column(type: "TEXT", nullable: false), - TimeStamp = table.Column(type: "TEXT", nullable: false), - Exception = table.Column(type: "TEXT", nullable: true), - UserName = table.Column(type: "TEXT", nullable: true), - ClientIP = table.Column(type: "TEXT", nullable: true), - ClientAgent = table.Column(type: "TEXT", nullable: true), - Properties = table.Column(type: "TEXT", nullable: true), - LogEvent = table.Column(type: "TEXT", nullable: true) + Name = table.Column(type: "TEXT", maxLength: 80, nullable: false), + Description = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Brand = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Unit = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Price = table.Column(type: "TEXT", nullable: false), + Pictures = table.Column(type: "TEXT", nullable: true), + Created = table.Column(type: "TEXT", nullable: true), + CreatedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), + LastModified = table.Column(type: "TEXT", nullable: true), + LastModifiedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true) }, constraints: table => { - table.PrimaryKey("PK_Loggers", x => x.Id); + table.PrimaryKey("PK_Products", x => x.Id); }); migrationBuilder.CreateTable( - name: "Products", + name: "Tenants", columns: table => new { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: true), - Description = table.Column(type: "TEXT", nullable: true), - Brand = table.Column(type: "TEXT", nullable: true), - Unit = table.Column(type: "TEXT", nullable: true), - Price = table.Column(type: "TEXT", nullable: false), - Pictures = table.Column(type: "TEXT", nullable: true), + Id = table.Column(type: "TEXT", maxLength: 450, nullable: false), + Name = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Description = table.Column(type: "TEXT", maxLength: 450, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Tenants", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetRoles", + columns: table => new + { + Id = table.Column(type: "TEXT", maxLength: 450, nullable: false), + TenantId = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Description = table.Column(type: "TEXT", maxLength: 450, nullable: true), Created = table.Column(type: "TEXT", nullable: true), - CreatedBy = table.Column(type: "TEXT", nullable: true), + CreatedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), LastModified = table.Column(type: "TEXT", nullable: true), - LastModifiedBy = table.Column(type: "TEXT", nullable: true) + LastModifiedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", maxLength: 450, nullable: true) }, constraints: table => { - table.PrimaryKey("PK_Products", x => x.Id); + table.PrimaryKey("PK_AspNetRoles", x => x.Id); + table.ForeignKey( + name: "FK_AspNetRoles_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id"); }); migrationBuilder.CreateTable( - name: "Tenants", + name: "AspNetUsers", columns: table => new { - Id = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: true), - Description = table.Column(type: "TEXT", nullable: true), + Id = table.Column(type: "TEXT", maxLength: 450, nullable: false), + DisplayName = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Provider = table.Column(type: "TEXT", maxLength: 450, nullable: true), + TenantId = table.Column(type: "TEXT", maxLength: 450, nullable: true), + ProfilePictureDataUrl = table.Column(type: "TEXT", maxLength: 450, nullable: true), + IsActive = table.Column(type: "INTEGER", nullable: false), + IsLive = table.Column(type: "INTEGER", nullable: false), + RefreshToken = table.Column(type: "TEXT", maxLength: 450, nullable: true), + RefreshTokenExpiryTime = table.Column(type: "TEXT", nullable: false), + SuperiorId = table.Column(type: "TEXT", maxLength: 450, nullable: true), Created = table.Column(type: "TEXT", nullable: true), - CreatedBy = table.Column(type: "TEXT", nullable: true), + CreatedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), LastModified = table.Column(type: "TEXT", nullable: true), - LastModifiedBy = table.Column(type: "TEXT", nullable: true) + LastModifiedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), + TimeZoneId = table.Column(type: "TEXT", maxLength: 450, nullable: true), + LanguageCode = table.Column(type: "TEXT", maxLength: 450, nullable: true), + UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "INTEGER", nullable: false), + PasswordHash = table.Column(type: "TEXT", maxLength: 450, nullable: true), + SecurityStamp = table.Column(type: "TEXT", maxLength: 450, nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", maxLength: 450, nullable: true), + PhoneNumber = table.Column(type: "TEXT", maxLength: 450, nullable: true), + PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), + TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), + LockoutEnd = table.Column(type: "TEXT", nullable: true), + LockoutEnabled = table.Column(type: "INTEGER", nullable: false), + AccessFailedCount = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_Tenants", x => x.Id); + table.PrimaryKey("PK_AspNetUsers", x => x.Id); + table.ForeignKey( + name: "FK_AspNetUsers_AspNetUsers_CreatedBy", + column: x => x.CreatedBy, + principalTable: "AspNetUsers", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AspNetUsers_AspNetUsers_LastModifiedBy", + column: x => x.LastModifiedBy, + principalTable: "AspNetUsers", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AspNetUsers_AspNetUsers_SuperiorId", + column: x => x.SuperiorId, + principalTable: "AspNetUsers", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AspNetUsers_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -171,11 +214,11 @@ protected override void Up(MigrationBuilder migrationBuilder) { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), - Description = table.Column(type: "TEXT", nullable: true), - Group = table.Column(type: "TEXT", nullable: true), - RoleId = table.Column(type: "TEXT", nullable: false), - ClaimType = table.Column(type: "TEXT", nullable: true), - ClaimValue = table.Column(type: "TEXT", nullable: true) + Description = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Group = table.Column(type: "TEXT", maxLength: 450, nullable: true), + RoleId = table.Column(type: "TEXT", maxLength: 450, nullable: false), + ClaimType = table.Column(type: "TEXT", maxLength: 450, nullable: true), + ClaimValue = table.Column(type: "TEXT", maxLength: 450, nullable: true) }, constraints: table => { @@ -194,10 +237,10 @@ protected override void Up(MigrationBuilder migrationBuilder) { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), - Description = table.Column(type: "TEXT", nullable: true), - UserId = table.Column(type: "TEXT", nullable: false), - ClaimType = table.Column(type: "TEXT", nullable: true), - ClaimValue = table.Column(type: "TEXT", nullable: true) + Description = table.Column(type: "TEXT", maxLength: 450, nullable: true), + UserId = table.Column(type: "TEXT", maxLength: 450, nullable: false), + ClaimType = table.Column(type: "TEXT", maxLength: 450, nullable: true), + ClaimValue = table.Column(type: "TEXT", maxLength: 450, nullable: true) }, constraints: table => { @@ -214,10 +257,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "AspNetUserLogins", columns: table => new { - LoginProvider = table.Column(type: "TEXT", nullable: false), - ProviderKey = table.Column(type: "TEXT", nullable: false), - ProviderDisplayName = table.Column(type: "TEXT", nullable: true), - UserId = table.Column(type: "TEXT", nullable: false) + LoginProvider = table.Column(type: "TEXT", maxLength: 450, nullable: false), + ProviderKey = table.Column(type: "TEXT", maxLength: 450, nullable: false), + ProviderDisplayName = table.Column(type: "TEXT", maxLength: 450, nullable: true), + UserId = table.Column(type: "TEXT", maxLength: 450, nullable: false) }, constraints: table => { @@ -234,8 +277,8 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "AspNetUserRoles", columns: table => new { - UserId = table.Column(type: "TEXT", nullable: false), - RoleId = table.Column(type: "TEXT", nullable: false) + UserId = table.Column(type: "TEXT", maxLength: 450, nullable: false), + RoleId = table.Column(type: "TEXT", maxLength: 450, nullable: false) }, constraints: table => { @@ -258,10 +301,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "AspNetUserTokens", columns: table => new { - UserId = table.Column(type: "TEXT", nullable: false), - LoginProvider = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: false), - Value = table.Column(type: "TEXT", nullable: true) + UserId = table.Column(type: "TEXT", maxLength: 450, nullable: false), + LoginProvider = table.Column(type: "TEXT", maxLength: 450, nullable: false), + Name = table.Column(type: "TEXT", maxLength: 450, nullable: false), + Value = table.Column(type: "TEXT", maxLength: 450, nullable: true) }, constraints: table => { @@ -280,14 +323,16 @@ protected override void Up(MigrationBuilder migrationBuilder) { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column(type: "TEXT", nullable: true), + UserId = table.Column(type: "TEXT", maxLength: 450, nullable: true), AuditType = table.Column(type: "TEXT", nullable: false), - TableName = table.Column(type: "TEXT", nullable: true), + TableName = table.Column(type: "TEXT", maxLength: 450, nullable: true), DateTime = table.Column(type: "TEXT", nullable: false), OldValues = table.Column(type: "TEXT", nullable: true), NewValues = table.Column(type: "TEXT", nullable: true), AffectedColumns = table.Column(type: "TEXT", nullable: true), - PrimaryKey = table.Column(type: "TEXT", nullable: false) + PrimaryKey = table.Column(type: "TEXT", nullable: false), + DebugView = table.Column(type: "TEXT", maxLength: 2147483647, nullable: true), + ErrorMessage = table.Column(type: "TEXT", maxLength: 2147483647, nullable: true) }, constraints: table => { @@ -296,7 +341,8 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK_AuditTrails_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", - principalColumn: "Id"); + principalColumn: "Id", + onDelete: ReferentialAction.SetNull); }); migrationBuilder.CreateTable( @@ -305,18 +351,18 @@ protected override void Up(MigrationBuilder migrationBuilder) { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), - Title = table.Column(type: "TEXT", nullable: true), - Description = table.Column(type: "TEXT", nullable: true), + Title = table.Column(type: "TEXT", maxLength: 450, nullable: true), + Description = table.Column(type: "TEXT", maxLength: 450, nullable: true), Status = table.Column(type: "INTEGER", nullable: false), - Content = table.Column(type: "TEXT", nullable: true), + Content = table.Column(type: "TEXT", maxLength: 4000, nullable: true), IsPublic = table.Column(type: "INTEGER", nullable: false), - URL = table.Column(type: "TEXT", nullable: true), + URL = table.Column(type: "TEXT", maxLength: 450, nullable: true), DocumentType = table.Column(type: "TEXT", nullable: false), - TenantId = table.Column(type: "TEXT", nullable: true), + TenantId = table.Column(type: "TEXT", maxLength: 450, nullable: true), Created = table.Column(type: "TEXT", nullable: true), - CreatedBy = table.Column(type: "TEXT", nullable: true), + CreatedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true), LastModified = table.Column(type: "TEXT", nullable: true), - LastModifiedBy = table.Column(type: "TEXT", nullable: true) + LastModifiedBy = table.Column(type: "TEXT", maxLength: 450, nullable: true) }, constraints: table => { @@ -325,12 +371,14 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK_Documents_AspNetUsers_CreatedBy", column: x => x.CreatedBy, principalTable: "AspNetUsers", - principalColumn: "Id"); + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_Documents_AspNetUsers_LastModifiedBy", column: x => x.LastModifiedBy, principalTable: "AspNetUsers", - principalColumn: "Id"); + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_Documents_Tenants_TenantId", column: x => x.TenantId, @@ -344,11 +392,16 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "RoleId"); migrationBuilder.CreateIndex( - name: "RoleNameIndex", + name: "IX_AspNetRoles_TenantId_Name", table: "AspNetRoles", - column: "NormalizedName", + columns: new[] { "TenantId", "Name" }, unique: true); + migrationBuilder.CreateIndex( + name: "RoleNameIndex", + table: "AspNetRoles", + column: "NormalizedName"); + migrationBuilder.CreateIndex( name: "IX_AspNetUserClaims_UserId", table: "AspNetUserClaims", @@ -369,11 +422,26 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "AspNetUsers", column: "NormalizedEmail"); + migrationBuilder.CreateIndex( + name: "IX_AspNetUsers_CreatedBy", + table: "AspNetUsers", + column: "CreatedBy"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUsers_LastModifiedBy", + table: "AspNetUsers", + column: "LastModifiedBy"); + migrationBuilder.CreateIndex( name: "IX_AspNetUsers_SuperiorId", table: "AspNetUsers", column: "SuperiorId"); + migrationBuilder.CreateIndex( + name: "IX_AspNetUsers_TenantId", + table: "AspNetUsers", + column: "TenantId"); + migrationBuilder.CreateIndex( name: "UserNameIndex", table: "AspNetUsers", @@ -399,6 +467,28 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_Documents_TenantId", table: "Documents", column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Loggers_Level", + table: "Loggers", + column: "Level"); + + migrationBuilder.CreateIndex( + name: "IX_Loggers_TimeStamp", + table: "Loggers", + column: "TimeStamp"); + + migrationBuilder.CreateIndex( + name: "IX_PicklistSets_Name_Value", + table: "PicklistSets", + columns: new[] { "Name", "Value" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Products_Name", + table: "Products", + column: "Name", + unique: true); } /// @@ -423,17 +513,20 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "AuditTrails"); migrationBuilder.DropTable( - name: "Customers"); + name: "Contacts"); migrationBuilder.DropTable( - name: "Documents"); + name: "DataProtectionKeys"); migrationBuilder.DropTable( - name: "KeyValues"); + name: "Documents"); migrationBuilder.DropTable( name: "Loggers"); + migrationBuilder.DropTable( + name: "PicklistSets"); + migrationBuilder.DropTable( name: "Products"); diff --git a/src/Migrators/Migrators.SqLite/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Migrators/Migrators.SqLite/Migrations/ApplicationDbContextModelSnapshot.cs index 398556839..e0750d7de 100644 --- a/src/Migrators/Migrators.SqLite/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Migrators/Migrators.SqLite/Migrations/ApplicationDbContextModelSnapshot.cs @@ -15,7 +15,7 @@ partial class ApplicationDbContextModelSnapshot : ModelSnapshot protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); + modelBuilder.HasAnnotation("ProductVersion", "9.0.0-rc.2.24474.1"); modelBuilder.Entity("CleanArchitecture.Blazor.Domain.Entities.AuditTrail", b => { diff --git a/src/Migrators/Migrators.SqLite/Migrators.SqLite.csproj b/src/Migrators/Migrators.SqLite/Migrators.SqLite.csproj index ebf76a19c..3bcb937d7 100644 --- a/src/Migrators/Migrators.SqLite/Migrators.SqLite.csproj +++ b/src/Migrators/Migrators.SqLite/Migrators.SqLite.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 enable enable CleanArchitecture.Blazor.Migrators.SqLite @@ -10,7 +10,11 @@ - + + + + + diff --git a/src/Server.UI/Components/App.razor b/src/Server.UI/Components/App.razor index 2d30befaf..129504736 100644 --- a/src/Server.UI/Components/App.razor +++ b/src/Server.UI/Components/App.razor @@ -6,9 +6,10 @@ - - + + + diff --git a/src/Server.UI/Components/Autocompletes/LanguageAutocomplete.cs b/src/Server.UI/Components/Autocompletes/LanguageAutocomplete.cs index cb52cbc5d..6504322f3 100644 --- a/src/Server.UI/Components/Autocompletes/LanguageAutocomplete.cs +++ b/src/Server.UI/Components/Autocompletes/LanguageAutocomplete.cs @@ -4,8 +4,6 @@ namespace CleanArchitecture.Blazor.Server.UI.Components.Autocompletes; public class LanguageAutocomplete : MudAutocomplete { - - private List Languages { get; set; }= LocalizationConstants.SupportedLanguages.ToList(); public LanguageAutocomplete() { SearchFunc = SearchFunc_; @@ -13,11 +11,13 @@ public LanguageAutocomplete() ResetValueOnEmptyText = true; ToStringFunc = x => { - var language = Languages.FirstOrDefault(lang =>lang.Code.Equals(x, StringComparison.OrdinalIgnoreCase)); + var language = Languages.FirstOrDefault(lang => lang.Code.Equals(x, StringComparison.OrdinalIgnoreCase)); return language != null ? $"{language.DisplayName}" : x; }; } + private List Languages { get; set; } = LocalizationConstants.SupportedLanguages.ToList(); + private Task> SearchFunc_(string value, CancellationToken cancellation = default) { // 如果输入为空,返回完整的语言列表;否则进行模糊搜索 @@ -31,7 +31,6 @@ private Task> SearchFunc_(string value, CancellationToken ca private static bool Contains(LanguageCode language, string value) { return language.Code.Contains(value, StringComparison.InvariantCultureIgnoreCase) || - language.DisplayName.Contains(value, StringComparison.InvariantCultureIgnoreCase); + language.DisplayName.Contains(value, StringComparison.InvariantCultureIgnoreCase); } - -} +} \ No newline at end of file diff --git a/src/Server.UI/Components/Autocompletes/MultiTenantAutocomplete.razor.cs b/src/Server.UI/Components/Autocompletes/MultiTenantAutocomplete.razor.cs index 8e3ea55a9..4ba0cf5bc 100644 --- a/src/Server.UI/Components/Autocompletes/MultiTenantAutocomplete.razor.cs +++ b/src/Server.UI/Components/Autocompletes/MultiTenantAutocomplete.razor.cs @@ -5,9 +5,6 @@ namespace CleanArchitecture.Blazor.Server.UI.Components.Autocompletes; public class MultiTenantAutocomplete : MudAutocomplete { - [Inject] - private ITenantService TenantsService { get; set; } = default!; - public MultiTenantAutocomplete() { SearchFunc = SearchKeyValues; @@ -17,6 +14,8 @@ public MultiTenantAutocomplete() ShowProgressIndicator = true; } + [Inject] private ITenantService TenantsService { get; set; } = default!; + protected override void OnInitialized() { base.OnInitialized(); @@ -28,31 +27,24 @@ private async Task TenantsService_OnChange() await InvokeAsync(StateHasChanged); } - protected override void Dispose(bool disposing) + protected override async ValueTask DisposeAsyncCore() { - if (disposing) - { - TenantsService.OnChange -= TenantsService_OnChange; - } - base.Dispose(disposing); + TenantsService.OnChange -= TenantsService_OnChange; + await base.DisposeAsyncCore(); } - private Task> SearchKeyValues(string value,CancellationToken cancellation) + private Task> SearchKeyValues(string value, CancellationToken cancellation) { IEnumerable result; if (string.IsNullOrWhiteSpace(value)) - { result = TenantsService.DataSource.ToList(); - } else - { result = TenantsService.DataSource .Where(x => x.Name?.Contains(value, StringComparison.InvariantCultureIgnoreCase) == true || x.Description?.Contains(value, StringComparison.InvariantCultureIgnoreCase) == true) .ToList(); - } return Task.FromResult(result); } -} +} \ No newline at end of file diff --git a/src/Server.UI/Components/Autocompletes/PickSuperiorIdAutocomplete.razor.cs b/src/Server.UI/Components/Autocompletes/PickSuperiorIdAutocomplete.razor.cs index c5e7784bf..95b6d7628 100644 --- a/src/Server.UI/Components/Autocompletes/PickSuperiorIdAutocomplete.razor.cs +++ b/src/Server.UI/Components/Autocompletes/PickSuperiorIdAutocomplete.razor.cs @@ -5,43 +5,43 @@ namespace CleanArchitecture.Blazor.Server.UI.Components.Autocompletes; public class PickSuperiorIdAutocomplete : MudAutocomplete { - - [Parameter] public string? TenantId { get; set; } - [Parameter] public string? OwnerName { get; set; } - [Inject] private IUserService UserService { get; set; } = default!; public PickSuperiorIdAutocomplete() { - SearchFunc = SearchKeyValues; - ToStringFunc = dto=>dto?.UserName; + ToStringFunc = dto => dto?.UserName; Clearable = true; Dense = true; ResetValueOnEmptyText = true; ShowProgressIndicator = true; MaxItems = 200; } + [Parameter] public string? TenantId { get; set; } + [Parameter] public string? OwnerName { get; set; } + + [Inject] private IUserService UserService { get; set; } = default!; + private Task> SearchKeyValues(string value, CancellationToken cancellation) { - IEnumerable result= UserService.DataSource.Where(x => (x.TenantId!=null && x.TenantId.Equals(TenantId)) && !x.UserName.Equals(OwnerName)); + var result = UserService.DataSource.Where(x => + x.TenantId != null && x.TenantId.Equals(TenantId) && !x.UserName.Equals(OwnerName)); if (!string.IsNullOrWhiteSpace(value)) - { - result = UserService.DataSource.Where(x => x.TenantId.Equals(TenantId) && !x.UserName.Equals(OwnerName) && (x.UserName.Contains(value, StringComparison.OrdinalIgnoreCase) || - x.Email.Contains(value, StringComparison.OrdinalIgnoreCase))); - } + result = UserService.DataSource.Where(x => x.TenantId.Equals(TenantId) && !x.UserName.Equals(OwnerName) && + (x.UserName.Contains(value, + StringComparison.OrdinalIgnoreCase) || + x.Email.Contains(value, StringComparison.OrdinalIgnoreCase))); return Task.FromResult(result); } protected override void OnInitialized() { UserService.OnChange += TenantsService_OnChange; } - private async Task TenantsService_OnChange() { await InvokeAsync(StateHasChanged); } - protected override void Dispose(bool disposing) + protected override async ValueTask DisposeAsyncCore() { UserService.OnChange -= TenantsService_OnChange; - base.Dispose(disposing); + await base.DisposeAsyncCore(); } } \ No newline at end of file diff --git a/src/Server.UI/Components/Autocompletes/PickUserAutocomplete.razor.cs b/src/Server.UI/Components/Autocompletes/PickUserAutocomplete.razor.cs index 885639409..0ba5ca5e7 100644 --- a/src/Server.UI/Components/Autocompletes/PickUserAutocomplete.razor.cs +++ b/src/Server.UI/Components/Autocompletes/PickUserAutocomplete.razor.cs @@ -5,7 +5,7 @@ namespace CleanArchitecture.Blazor.Server.UI.Components.Autocompletes; public class PickUserAutocomplete : MudAutocomplete { - public PickUserAutocomplete() + public PickUserAutocomplete() { SearchFunc = SearchKeyValues; ToStringFunc = dto => dto?.UserName; @@ -15,6 +15,7 @@ public PickUserAutocomplete() ShowProgressIndicator = true; MaxItems = 50; } + [Parameter] public string? TenantId { get; set; } [Inject] private IUserService UserService { get; set; } = default!; @@ -26,26 +27,24 @@ protected override void OnInitialized() private async Task TenantsService_OnChange() { - await InvokeAsync(StateHasChanged); + await InvokeAsync(StateHasChanged); } - protected override void Dispose(bool disposing) + protected override async ValueTask DisposeAsyncCore() { UserService.OnChange -= TenantsService_OnChange; - base.Dispose(disposing); + await base.DisposeAsyncCore(); } - private Task> SearchKeyValues(string value,CancellationToken cancellation) + + private Task> SearchKeyValues(string value, CancellationToken cancellation) { - IEnumerable result = UserService.DataSource.Where(x =>x.TenantId!=null && x.TenantId.Equals(TenantId)); + var result = UserService.DataSource.Where(x => x.TenantId != null && x.TenantId.Equals(TenantId)); if (!string.IsNullOrEmpty(value)) - { - result = UserService.DataSource.Where(x => x.TenantId != null&& x.TenantId.Equals(TenantId) && - (x.UserName.Contains(value, StringComparison.OrdinalIgnoreCase) || - x.Email.Contains(value, StringComparison.OrdinalIgnoreCase))); - } + result = UserService.DataSource.Where(x => x.TenantId != null && x.TenantId.Equals(TenantId) && + (x.UserName.Contains(value, + StringComparison.OrdinalIgnoreCase) || + x.Email.Contains(value, StringComparison.OrdinalIgnoreCase))); return Task.FromResult(result); } - - } \ No newline at end of file diff --git a/src/Server.UI/Components/Autocompletes/PicklistAutocomplete.razor.cs b/src/Server.UI/Components/Autocompletes/PicklistAutocomplete.razor.cs index 39d8616ed..b8ddff3c6 100644 --- a/src/Server.UI/Components/Autocompletes/PicklistAutocomplete.razor.cs +++ b/src/Server.UI/Components/Autocompletes/PicklistAutocomplete.razor.cs @@ -4,6 +4,21 @@ namespace CleanArchitecture.Blazor.Server.UI.Components.Autocompletes; public class PicklistAutocomplete : MudAutocomplete { + public PicklistAutocomplete() + { + SearchFunc = SearchFunc_; + Clearable = true; + Dense = true; + ResetValueOnEmptyText = true; + ToStringFunc = x => + { + if (x != null && PicklistService != null) + return PicklistService.DataSource.FirstOrDefault(y => y.Value != null && + y.Value.Equals(x))?.Text ?? x; + return x; + }; + } + [Parameter] public Picklist Picklist { get; set; } [Inject] private IPicklistService PicklistService { get; set; } = default!; @@ -16,30 +31,16 @@ protected override async Task OnInitializedAsync() private async Task PicklistService_OnChange() { - await InvokeAsync(StateHasChanged); + await InvokeAsync(StateHasChanged); } - protected override void Dispose(bool disposing) + protected override async ValueTask DisposeAsyncCore() { PicklistService.OnChange -= PicklistService_OnChange; - base.Dispose(disposing); + await base.DisposeAsyncCore(); } - public PicklistAutocomplete() - { - SearchFunc = SearchFunc_; - Clearable = true; - Dense = true; - ResetValueOnEmptyText = true; - ToStringFunc = x => - { - if(x!=null && PicklistService!=null) - return PicklistService.DataSource.FirstOrDefault(y=>y.Value!=null && - y.Value.Equals(x))?.Text ?? x; - return x; - }; - } - - private Task> SearchFunc_(string value,CancellationToken cancellation=default) + + private Task> SearchFunc_(string value, CancellationToken cancellation = default) { // if text is null or empty, show complete list return string.IsNullOrEmpty(value) diff --git a/src/Server.UI/Components/Autocompletes/TimeZoneAutocomplete.cs b/src/Server.UI/Components/Autocompletes/TimeZoneAutocomplete.cs index b09bbbfd8..5ffa53b57 100644 --- a/src/Server.UI/Components/Autocompletes/TimeZoneAutocomplete.cs +++ b/src/Server.UI/Components/Autocompletes/TimeZoneAutocomplete.cs @@ -2,7 +2,6 @@ public class TimeZoneAutocomplete : MudAutocomplete { - private List TimeZones { get; set; }= TimeZoneInfo.GetSystemTimeZones().ToList(); public TimeZoneAutocomplete() { SearchFunc = SearchFunc_; @@ -15,6 +14,8 @@ public TimeZoneAutocomplete() }; } + private List TimeZones { get; set; } = TimeZoneInfo.GetSystemTimeZones().ToList(); + private Task> SearchFunc_(string value, CancellationToken cancellation = default) { return string.IsNullOrEmpty(value) diff --git a/src/Server.UI/Components/Dialogs/ConfirmationDialog.razor b/src/Server.UI/Components/Dialogs/ConfirmationDialog.razor index 2ecdefc9e..ecdfbc353 100644 --- a/src/Server.UI/Components/Dialogs/ConfirmationDialog.razor +++ b/src/Server.UI/Components/Dialogs/ConfirmationDialog.razor @@ -13,7 +13,7 @@ @code { - [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!; [Parameter] public string? ContentText { get; set; } diff --git a/src/Server.UI/Components/Dialogs/DeleteConfirmation.razor b/src/Server.UI/Components/Dialogs/DeleteConfirmation.razor index 15d79c67f..0fd2adf35 100644 --- a/src/Server.UI/Components/Dialogs/DeleteConfirmation.razor +++ b/src/Server.UI/Components/Dialogs/DeleteConfirmation.razor @@ -18,7 +18,7 @@ @code { - [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!; [EditorRequired][Parameter] public string? ContentText { get; set; } [EditorRequired][Parameter] public IRequest> Command { get; set; } = default!; diff --git a/src/Server.UI/Components/Dialogs/LogoutConfirmation.razor b/src/Server.UI/Components/Dialogs/LogoutConfirmation.razor index a7f88d49a..77db9c763 100644 --- a/src/Server.UI/Components/Dialogs/LogoutConfirmation.razor +++ b/src/Server.UI/Components/Dialogs/LogoutConfirmation.razor @@ -17,7 +17,7 @@ @code { - [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!; [Parameter] public string? ContentText { get; set; } diff --git a/src/Server.UI/Components/Shared/Layout/AuthenticationLayout.razor b/src/Server.UI/Components/Shared/Layout/AuthenticationLayout.razor index da390b0a3..734485e97 100644 --- a/src/Server.UI/Components/Shared/Layout/AuthenticationLayout.razor +++ b/src/Server.UI/Components/Shared/Layout/AuthenticationLayout.razor @@ -1,4 +1,4 @@ -@using CleanArchitecture.Blazor.Server.UI.Constants +@using CleanArchitecture.Blazor.Server.UI.Themes @using Microsoft.AspNetCore.Components.Authorization @inherits LayoutComponentBase @inject IStringLocalizer L diff --git a/src/Server.UI/Components/Shared/Layout/MainLayout.razor b/src/Server.UI/Components/Shared/Layout/MainLayout.razor index 0dbdc3f0c..87c5dce91 100644 --- a/src/Server.UI/Components/Shared/Layout/MainLayout.razor +++ b/src/Server.UI/Components/Shared/Layout/MainLayout.razor @@ -1,6 +1,6 @@ @inherits LayoutComponentBase -@using CleanArchitecture.Blazor.Server.UI.Constants @using CleanArchitecture.Blazor.Server.UI.Services.JsInterop +@using CleanArchitecture.Blazor.Server.UI.Themes @implements IDisposable @inject LayoutService LayoutService @ApplicationSettings.AppName diff --git a/src/Server.UI/Components/Shared/Layout/SearchDialog.razor b/src/Server.UI/Components/Shared/Layout/SearchDialog.razor index 0b605e546..c863b7403 100644 --- a/src/Server.UI/Components/Shared/Layout/SearchDialog.razor +++ b/src/Server.UI/Components/Shared/Layout/SearchDialog.razor @@ -28,7 +28,7 @@ @code { - [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!; private readonly Dictionary _pages = new(); private HotKeysContext? _hotKeysContext; diff --git a/src/Server.UI/DependencyInjection.cs b/src/Server.UI/DependencyInjection.cs index 9957b2923..f252f9bf5 100644 --- a/src/Server.UI/DependencyInjection.cs +++ b/src/Server.UI/DependencyInjection.cs @@ -16,7 +16,7 @@ using QuestPDF.Infrastructure; using Toolbelt.Blazor.Extensions.DependencyInjection; using CleanArchitecture.Blazor.Server.UI.Middlewares; -using Polly; +using CleanArchitecture.Blazor.Application; namespace CleanArchitecture.Blazor.Server.UI; @@ -94,7 +94,7 @@ public static IServiceCollection AddServerUI(this IServiceCollection services, I { c.BaseAddress = new Uri("http://10.33.1.150:8000/ocr/predict-by-file"); c.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); - }).AddTransientHttpErrorPolicy(policy => policy.WaitAndRetryAsync(3, _ => TimeSpan.FromSeconds(30))); + }); services.AddScoped(); services.AddHttpContextAccessor(); services.AddScoped(); @@ -137,18 +137,21 @@ public static WebApplication ConfigureServer(this WebApplication app, IConfigura // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } - + app.InitializeCacheFactory(); app.UseStatusCodePagesWithRedirects("/404"); app.MapHealthChecks("/health"); app.UseAuthentication(); app.UseAuthorization(); app.UseAntiforgery(); app.UseHttpsRedirection(); - app.UseStaticFiles(); + app.MapStaticAssets(); + if (!Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), @"Files"))) Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), @"Files")); + + app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"Files")), @@ -180,6 +183,7 @@ public static WebApplication ConfigureServer(this WebApplication app, IConfigura { // We obviously need this KeepAliveInterval = TimeSpan.FromSeconds(30), // Just in case }); + return app; } } diff --git a/src/Server.UI/Pages/Contacts/Components/ContactFormDialog.razor b/src/Server.UI/Pages/Contacts/Components/ContactFormDialog.razor index a9d1de453..2263e5f37 100644 --- a/src/Server.UI/Pages/Contacts/Components/ContactFormDialog.razor +++ b/src/Server.UI/Pages/Contacts/Components/ContactFormDialog.razor @@ -6,43 +6,47 @@ - + @*TODO: define mudform that should be edit fields, for example:*@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @ConstantString.Cancel - @ConstantString.SaveAndNew - @ConstantString.Save + @ConstantString.SaveAndNew + @ConstantString.Save @code { - MudForm? _form; - private bool _saving = false; - private bool _savingnew = false; + private MudForm? _form; + private bool _saving; + private bool _savingNew; + [CascadingParameter] - MudDialogInstance MudDialog { get; set; } = default!; - AddEditContactCommandValidator _modelValidator = new (); - [EditorRequired] [Parameter] public AddEditContactCommand model { get; set; } = null!; + IMudDialogInstance MudDialog { get; set; } = default!; + + [EditorRequired] + [Parameter] + public AddEditContactCommand Model { get; set; } = null!; + async Task Submit() { try @@ -51,17 +55,21 @@ await _form!.Validate().ConfigureAwait(false); if (!_form!.IsValid) return; - var result = await Mediator.Send(model); - result.Match(data => - { - MudDialog.Close(DialogResult.Ok(true)); - Snackbar.Add(ConstantString.SaveSuccess, MudBlazor.Severity.Info); - return data; - }, errors => - { - Snackbar.Add(errors, MudBlazor.Severity.Error); - return -1; - }); + var result = await Mediator.Send(Model); + result.Match( + data => + { + MudDialog.Close(DialogResult.Ok(true)); + Snackbar.Add(ConstantString.SaveSuccess, Severity.Info); + return data; + }, + errors => + { + Snackbar.Add(errors, Severity.Error); + return 0; + } + ); + } finally { @@ -72,26 +80,29 @@ { try { - _savingnew = true; + _savingNew = true; await _form!.Validate().ConfigureAwait(false); if (!_form!.IsValid) - return; - var result = await Mediator.Send(model); - await result.MatchAsync(async data => - { - Snackbar.Add(ConstantString.SaveSuccess, MudBlazor.Severity.Info); - await Task.Delay(300); - model = new AddEditContactCommand() { }; - return data; - }, errors => - { - Snackbar.Add(errors, MudBlazor.Severity.Error); - return Task.FromResult(-1); - }); + return; + var result = await Mediator.Send(Model); + await result.MatchAsync( + async data => + { + Snackbar.Add(ConstantString.SaveSuccess, Severity.Info); + await Task.Delay(300); + Model = new AddEditContactCommand(); + return data; + }, + errors => + { + Snackbar.Add(errors, Severity.Error); + return Task.FromResult(0); + }); + } finally { - _savingnew = false; + _savingNew = false; } } void Cancel() => MudDialog.Cancel(); diff --git a/src/Server.UI/Pages/Contacts/Contacts.razor b/src/Server.UI/Pages/Contacts/Contacts.razor index c2a96fa62..0e677a4c1 100644 --- a/src/Server.UI/Pages/Contacts/Contacts.razor +++ b/src/Server.UI/Pages/Contacts/Contacts.razor @@ -244,13 +244,13 @@ { var parameters = new DialogParameters { - { x=>x.model,command }, + { x=> x.Model,command }, }; var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.Medium, FullWidth = true }; - var dialog = DialogService.Show(title, parameters, options); + var dialog = await DialogService.ShowAsync(title, parameters, options); var state = await dialog.Result; - if (state != null && !state.Canceled) + if (state is { Canceled: false }) { await _table.ReloadServerData(); _selectedItems.Clear(); diff --git a/src/Server.UI/Pages/Contacts/EditContact.razor b/src/Server.UI/Pages/Contacts/EditContact.razor index e30413a4f..8926594ca 100644 --- a/src/Server.UI/Pages/Contacts/EditContact.razor +++ b/src/Server.UI/Pages/Contacts/EditContact.razor @@ -9,43 +9,43 @@ @Title -@if (model != null) -{ - - - - @Title - - - - - - - - - - - - - - - - - - - - + @if (model != null) + { + + + + @Title + + + + + + + + + + + + + + + + + + + + - - - - - @ConstantString.Save - + + + + + @ConstantString.Save + } - + @code { public string? Title { get; private set; } @@ -88,12 +88,12 @@ return; var result = await Mediator.Send(model); result.Match( - data=> + data => { Snackbar.Add(ConstantString.SaveSuccess, MudBlazor.Severity.Info); return data; }, - errors=> + errors => { Snackbar.Add(errors, MudBlazor.Severity.Error); return 0; diff --git a/src/Server.UI/Pages/Documents/Components/DocumentFormDialog.razor b/src/Server.UI/Pages/Documents/Components/DocumentFormDialog.razor index 9585a40bf..dc5b37153 100644 --- a/src/Server.UI/Pages/Documents/Components/DocumentFormDialog.razor +++ b/src/Server.UI/Pages/Documents/Components/DocumentFormDialog.razor @@ -71,7 +71,7 @@ @code { - [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!; [EditorRequired][Parameter] public AddEditDocumentCommand Model { get; set; } = default!; diff --git a/src/Server.UI/Pages/Documents/Components/UploadFilesFormDialog.razor b/src/Server.UI/Pages/Documents/Components/UploadFilesFormDialog.razor index 97b54efe3..99e8774d0 100644 --- a/src/Server.UI/Pages/Documents/Components/UploadFilesFormDialog.razor +++ b/src/Server.UI/Pages/Documents/Components/UploadFilesFormDialog.razor @@ -55,7 +55,7 @@ @code{ - [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!; [EditorRequired] [Parameter] public AddEditDocumentCommand Model { get; set; } = default!; private MudFileUpload> _fileUpload=default!; diff --git a/src/Server.UI/Pages/Identity/Roles/Components/RoleFormDialog.razor b/src/Server.UI/Pages/Identity/Roles/Components/RoleFormDialog.razor index 27acde3b9..3244932ba 100644 --- a/src/Server.UI/Pages/Identity/Roles/Components/RoleFormDialog.razor +++ b/src/Server.UI/Pages/Identity/Roles/Components/RoleFormDialog.razor @@ -44,7 +44,7 @@ @code { - [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!; [EditorRequired] [Parameter] public ApplicationRoleDto Model { get; set; } = default!; diff --git a/src/Server.UI/Pages/Identity/Users/Components/ResetPasswordDialog.razor b/src/Server.UI/Pages/Identity/Users/Components/ResetPasswordDialog.razor index 0b75dfc92..50294256f 100644 --- a/src/Server.UI/Pages/Identity/Users/Components/ResetPasswordDialog.razor +++ b/src/Server.UI/Pages/Identity/Users/Components/ResetPasswordDialog.razor @@ -36,7 +36,7 @@ @code { - [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!; [EditorRequired][Parameter] public ResetPasswordFormModel Model { get; set; } = default!; diff --git a/src/Server.UI/Pages/Identity/Users/Components/UserForm.razor b/src/Server.UI/Pages/Identity/Users/Components/UserForm.razor index 179d5104d..443e11313 100644 --- a/src/Server.UI/Pages/Identity/Users/Components/UserForm.razor +++ b/src/Server.UI/Pages/Identity/Users/Components/UserForm.razor @@ -16,8 +16,8 @@ @inject IStringLocalizer L - - + + @@ -55,7 +55,7 @@ - + diff --git a/src/Server.UI/Pages/Identity/Users/Components/UserFormDialog.razor b/src/Server.UI/Pages/Identity/Users/Components/UserFormDialog.razor index 7cab1aae5..e0304fc10 100644 --- a/src/Server.UI/Pages/Identity/Users/Components/UserFormDialog.razor +++ b/src/Server.UI/Pages/Identity/Users/Components/UserFormDialog.razor @@ -14,7 +14,7 @@ @code{ - [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!; [Parameter] public UserProfile? UserProfile { get; set; } [Parameter] public ApplicationUserDto Model { get; set; } = default!; diff --git a/src/Server.UI/Pages/PicklistSets/Components/CreatePicklistDialog.razor b/src/Server.UI/Pages/PicklistSets/Components/CreatePicklistDialog.razor index ecc14eae2..bd1c17f67 100644 --- a/src/Server.UI/Pages/PicklistSets/Components/CreatePicklistDialog.razor +++ b/src/Server.UI/Pages/PicklistSets/Components/CreatePicklistDialog.razor @@ -45,7 +45,7 @@ @code { - [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!; [EditorRequired][Parameter] public AddEditPicklistSetCommand Model { get; set; } = default!; diff --git a/src/Server.UI/Pages/Products/Components/ProductFormDialog.razor b/src/Server.UI/Pages/Products/Components/ProductFormDialog.razor index ce4aee1ec..5a9f697df 100644 --- a/src/Server.UI/Pages/Products/Components/ProductFormDialog.razor +++ b/src/Server.UI/Pages/Products/Components/ProductFormDialog.razor @@ -120,7 +120,7 @@ @code { - [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!; [EditorRequired][Parameter] public AddEditProductCommand Model { get; set; } = default!; diff --git a/src/Server.UI/Pages/SystemManagement/Logs.razor b/src/Server.UI/Pages/SystemManagement/Logs.razor index 45c12f6e0..7a27cab37 100644 --- a/src/Server.UI/Pages/SystemManagement/Logs.razor +++ b/src/Server.UI/Pages/SystemManagement/Logs.razor @@ -1,4 +1,5 @@ @page "/system/logs" +@using CleanArchitecture.Blazor.Application.Features.Loggers.Caching @using CleanArchitecture.Blazor.Application.Features.Loggers.DTOs @using CleanArchitecture.Blazor.Application.Features.Loggers.Queries.PaginationQuery @using CleanArchitecture.Blazor.Application.Features.Loggers.Specifications @@ -43,9 +44,9 @@ @if (_canPurge) { + Disabled="@(_clearing)" + OnClick="@(OnPurge)" + StartIcon="@Icons.Material.Outlined.ClearAll"> @L["Clear Logs"] } @@ -53,7 +54,7 @@ + AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium"> @@ -130,7 +131,7 @@ @@ -199,6 +200,7 @@ private async Task OnRefresh() { Query.Keyword = string.Empty; + LogsCacheKey.Refresh(); await _table.ReloadServerData(); } diff --git a/src/Server.UI/Pages/Tenants/TenantFormDialog.razor b/src/Server.UI/Pages/Tenants/TenantFormDialog.razor index 01052542f..ad518fda3 100644 --- a/src/Server.UI/Pages/Tenants/TenantFormDialog.razor +++ b/src/Server.UI/Pages/Tenants/TenantFormDialog.razor @@ -37,7 +37,7 @@ @code { - [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!; [EditorRequired] [Parameter] public AddEditTenantCommand Model { get; set; } = default!; diff --git a/src/Server.UI/Server.UI.csproj b/src/Server.UI/Server.UI.csproj index e313b50a2..c4f63665c 100644 --- a/src/Server.UI/Server.UI.csproj +++ b/src/Server.UI/Server.UI.csproj @@ -3,7 +3,7 @@ CleanArchitecture.Blazor.Server.UI CleanArchitecture.Blazor.Server.UI - net8.0 + net9.0 enable $(NoWarn);VSTHRD200 enable @@ -15,18 +15,19 @@ default + + - - + + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - diff --git a/src/Server.UI/Services/Layout/LayoutService.cs b/src/Server.UI/Services/Layout/LayoutService.cs index aba0fe901..9c7adbac4 100644 --- a/src/Server.UI/Services/Layout/LayoutService.cs +++ b/src/Server.UI/Services/Layout/LayoutService.cs @@ -75,24 +75,24 @@ public async Task ApplyUserPreferences(bool isDarkModeDefaultTheme) CurrentTheme.LayoutProperties.DefaultBorderRadius = UserPreferences.BorderRadius + "px"; CurrentTheme.Typography.Default.FontSize = UserPreferences.DefaultFontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; - CurrentTheme.Typography.Input.FontSize = + CurrentTheme.Typography.Subtitle1.FontSize = UserPreferences.DefaultFontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; CurrentTheme.Typography.Button.FontSize = UserPreferences.ButtonFontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; - CurrentTheme.Typography.Button.LineHeight = UserPreferences.ButtonLineHeight; + CurrentTheme.Typography.Button.LineHeight = UserPreferences.ButtonLineHeight.ToString(); CurrentTheme.Typography.Body1.FontSize = UserPreferences.Body1FontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; - CurrentTheme.Typography.Body1.LineHeight = UserPreferences.Body1LineHeight; + CurrentTheme.Typography.Body1.LineHeight = UserPreferences.Body1LineHeight.ToString(); CurrentTheme.Typography.Body1.LetterSpacing = UserPreferences.Body1LetterSpacing.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; CurrentTheme.Typography.Body2.FontSize = UserPreferences.Body2FontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; - CurrentTheme.Typography.Body2.LineHeight = UserPreferences.Body1LineHeight; + CurrentTheme.Typography.Body2.LineHeight = UserPreferences.Body1LineHeight.ToString(); CurrentTheme.Typography.Body2.LetterSpacing = UserPreferences.Body1LetterSpacing.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; CurrentTheme.Typography.Caption.FontSize = UserPreferences.CaptionFontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; - CurrentTheme.Typography.Caption.LineHeight = UserPreferences.CaptionLineHeight; + CurrentTheme.Typography.Caption.LineHeight = UserPreferences.CaptionLineHeight.ToString(); CurrentTheme.Typography.Overline.FontSize = UserPreferences.OverlineFontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; CurrentTheme.Typography.Subtitle1.FontSize = @@ -252,24 +252,24 @@ public async Task UpdateUserPreferences(UserPreference preferences) CurrentTheme.LayoutProperties.DefaultBorderRadius = UserPreferences.BorderRadius + "px"; CurrentTheme.Typography.Default.FontSize = UserPreferences.DefaultFontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; - CurrentTheme.Typography.Input.FontSize = + CurrentTheme.Typography.Subtitle1.FontSize = UserPreferences.DefaultFontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; CurrentTheme.Typography.Button.FontSize = UserPreferences.ButtonFontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; - CurrentTheme.Typography.Button.LineHeight = UserPreferences.ButtonLineHeight; + CurrentTheme.Typography.Button.LineHeight = UserPreferences.ButtonLineHeight.ToString(); CurrentTheme.Typography.Body1.FontSize = UserPreferences.Body1FontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; - CurrentTheme.Typography.Body1.LineHeight = UserPreferences.Body1LineHeight; + CurrentTheme.Typography.Body1.LineHeight = UserPreferences.Body1LineHeight.ToString(); CurrentTheme.Typography.Body1.LetterSpacing = UserPreferences.Body1LetterSpacing.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; CurrentTheme.Typography.Body2.FontSize = UserPreferences.Body2FontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; - CurrentTheme.Typography.Body2.LineHeight = UserPreferences.Body1LineHeight; + CurrentTheme.Typography.Body2.LineHeight = UserPreferences.Body1LineHeight.ToString(); CurrentTheme.Typography.Body2.LetterSpacing = UserPreferences.Body1LetterSpacing.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; CurrentTheme.Typography.Caption.FontSize = UserPreferences.CaptionFontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; - CurrentTheme.Typography.Caption.LineHeight = UserPreferences.CaptionLineHeight; + CurrentTheme.Typography.Caption.LineHeight = UserPreferences.CaptionLineHeight.ToString(); CurrentTheme.Typography.Overline.FontSize = UserPreferences.OverlineFontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem"; CurrentTheme.Typography.Subtitle1.FontSize = diff --git a/src/Server.UI/Services/PermissionHelper.cs b/src/Server.UI/Services/PermissionHelper.cs index 1a439b54b..0ae248809 100644 --- a/src/Server.UI/Services/PermissionHelper.cs +++ b/src/Server.UI/Services/PermissionHelper.cs @@ -8,7 +8,7 @@ using System.Security.Claims; using ZiggyCreatures.Caching.Fusion; using CleanArchitecture.Blazor.Application.Common.ExceptionHandlers; -using System.Data.Entity; + namespace CleanArchitecture.Blazor.Server.UI.Services; diff --git a/src/Server.UI/Themes/Theme.cs b/src/Server.UI/Themes/Theme.cs index f76c5c455..ba674557b 100644 --- a/src/Server.UI/Themes/Theme.cs +++ b/src/Server.UI/Themes/Theme.cs @@ -1,4 +1,4 @@ -namespace CleanArchitecture.Blazor.Server.UI.Constants; +namespace CleanArchitecture.Blazor.Server.UI.Themes; public static class Theme { @@ -79,113 +79,105 @@ public static MudTheme ApplicationTheme() }, Typography = new Typography { - Default = new Default + Default = new DefaultTypography { FontSize = ".8125rem", - FontWeight = 400, - LineHeight = 1.4, + FontWeight = "400", + LineHeight = "1.4", LetterSpacing = "normal", - FontFamily = new[] { "Public Sans", "Roboto", "Arial", "sans-serif" } + FontFamily = ["Public Sans", "Roboto", "Arial", "sans-serif"] }, - Input =new Input - { - FontSize = ".8125rem", - FontWeight = 400, - LineHeight = 1.5, - LetterSpacing = "normal", - FontFamily = new[] { "Public Sans", "Roboto", "Arial", "sans-serif" } - }, - H1 = new H1 + H1 = new H1Typography { FontSize = "3.5rem", - FontWeight = 700, - LineHeight = 1.167, + FontWeight = "700", + LineHeight = "1.167", LetterSpacing = "-.01562em" }, - H2 = new H2 + H2 = new H2Typography { FontSize = "3rem", - FontWeight = 300, - LineHeight = 1.2, + FontWeight = "300", + LineHeight = "1.2", LetterSpacing = "-.00833em" }, - H3 = new H3 + H3 = new H3Typography { FontSize = "2rem", - FontWeight = 600, - LineHeight = 1.167, + FontWeight = "600", + LineHeight = "1.167", LetterSpacing = "0" }, - H4 = new H4 + H4 = new H4Typography { FontSize = "1.5rem", - FontWeight = 400, - LineHeight = 1.235, + FontWeight = "400", + LineHeight = "1.235", LetterSpacing = ".00735em" }, - H5 = new H5 + H5 = new H5Typography { FontSize = "1.25rem", - FontWeight = 400, - LineHeight = 1.3, + FontWeight = "400", + LineHeight = "1.3", LetterSpacing = "0" }, - H6 = new H6 + H6 = new H6Typography { FontSize = "1.125rem", - FontWeight = 600, - LineHeight = 1.5, + FontWeight = "600", + LineHeight = "1.5", LetterSpacing = ".0075em" }, - Button = new Button + Button = new ButtonTypography { FontSize = ".8125rem", - FontWeight = 500, - LineHeight = 1.75, + FontWeight = "500", + LineHeight = "1.75", LetterSpacing = ".02857em", TextTransform = "uppercase" }, - Subtitle1 = new Subtitle1 + Subtitle1 = new Subtitle1Typography { - FontSize = "1rem", - FontWeight = 600, - LineHeight = 1.75, - LetterSpacing = ".00938em", - TextTransform = "none" + FontSize = ".8125rem", + FontWeight = "400", + LineHeight = "1.5", + LetterSpacing = "normal", + FontFamily = ["Public Sans", "Roboto", "Arial", "sans-serif"] }, - Subtitle2 = new Subtitle2 + Subtitle2 = new Subtitle2Typography { FontSize = ".875rem", - FontWeight = 500, - LineHeight = 1.57, + FontWeight = "500", + LineHeight = "1.57", LetterSpacing = ".00714em" }, - Body1 = new Body1 + Body1 = new Body1Typography { FontSize = "0.875rem", - FontWeight = 400, - LineHeight = 1.5, + FontWeight = "400", + LineHeight = "1.5", LetterSpacing = ".00938em" }, - Body2 = new Body2 + Body2 = new Body2Typography { FontSize = ".8125rem", - FontWeight = 400, - LineHeight = 1.43, + FontWeight = "400", + LineHeight = "1.43", LetterSpacing = ".01071em" }, - Caption = new Caption + Caption = new CaptionTypography { FontSize = ".75rem", - FontWeight = 400, - LineHeight = 1.66, + FontWeight = "400", + LineHeight = "1.66", LetterSpacing = ".03333em" }, - Overline = new Overline + Overline = new OverlineTypography { FontSize = ".75rem", - FontWeight = 400, - LineHeight = 2.5, + FontWeight = "400", + LineHeight = "2.5", LetterSpacing = ".08333em" } }, diff --git a/src/Server.UI/appsettings.json b/src/Server.UI/appsettings.json index c5bbc2f3a..3fe25d52f 100644 --- a/src/Server.UI/appsettings.json +++ b/src/Server.UI/appsettings.json @@ -1,10 +1,10 @@ { "UseInMemoryDatabase": false, "DatabaseSettings": { - //"DBProvider": "sqlite", - //"ConnectionString": "Data Source=BlazorDashboardDb.db" - "DBProvider": "mssql", - "ConnectionString": "Server=(localdb)\\mssqllocaldb;Database=BlazorDashboardDb;Trusted_Connection=True;MultipleActiveResultSets=true;" + "DBProvider": "sqlite", + "ConnectionString": "Data Source=BlazorDashboardDb.db" + //"DBProvider": "mssql", + //"ConnectionString": "Server=(localdb)\\mssqllocaldb;Database=BlazorDashboardDb;Trusted_Connection=True;MultipleActiveResultSets=true;" //"DBProvider": "postgresql", //"ConnectionString": "Server=127.0.0.1;Database=BlazorDashboardDb;User Id=root;Password=root;Port=5432" }, @@ -35,8 +35,8 @@ "Version": "24.4.1", "App": "Blazor", "AppName": "Blazor Dashboard", - "AppFlavor": "Blazor .NET 8.0", - "AppFlavorSubscript": ".NET 8.0", + "AppFlavor": "Blazor .NET 9.0", + "AppFlavorSubscript": ".NET 9.0", "Company": "Company", "Copyright": "@2024 Copyright" }, @@ -66,7 +66,8 @@ }, "Properties": { "Application": "BlazorApp", - "Environment": "Development" + "Environment": "Development", + "TargetFramework": "net9" }, "WriteTo": [ { diff --git a/src/Server.UI/wwwroot/css/app.css b/src/Server.UI/wwwroot/css/app.css index 4b9b4bcb3..6b9df9791 100644 --- a/src/Server.UI/wwwroot/css/app.css +++ b/src/Server.UI/wwwroot/css/app.css @@ -17,8 +17,13 @@ .mud-input-control > .mud-input-control-input-container > .mud-input-label-inputcontrol { font-size: var(--mud-typography-subtitle1-size); } - -.mud-simple-table table * tr > td, .mud-simple-table table * tr th { +.mud-input > input.mud-input-root, div.mud-input-slot.mud-input-root { + font-size: var(--mud-typography-default-size) !important; +} +.mud-input > textarea.mud-input-root { + font-size: var(--mud-typography-default-size) !important; +} + .mud-simple-table table * tr > td, .mud-simple-table table * tr th { font-size: var(--mud-typography-default-size) !important; } @@ -59,38 +64,6 @@ padding-bottom:2px; } -#blazor-error-ui { - background: lightyellow; - background-color: var(--mud-palette-error); - color: var(--mud-palette-error-text); - bottom: 0; - box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); - display: none; - left: 0; - padding: 0.6rem 1.25rem 0.7rem 1.25rem; - padding: 0.6rem 1.75rem 0.7rem 1.25rem; - position: fixed; - width: 100%; - z-index: 9999; -} - -#reconnect-modal { - background: lightyellow; - background-color: var(--mud-palette-warning-hover); - color: var(--mud-palette-warning-darken); - top: 0; - box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); - display: none; - left: 0; - padding: 0.6rem 1.25rem 0.7rem 1.25rem; - padding: 0.6rem 1.75rem 0.7rem 1.25rem; - margin: 0px; - position: fixed; - width: 100%; - z-index: 9999; -} - - .mud-nav-link { white-space: normal !important; } @@ -103,4 +76,15 @@ .side-menu .mud-chip.mud-chip-size-small { font-size: 0.625rem; height: 1.125rem; -} \ No newline at end of file +} + + +.blazor-error-boundary { + background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121; + padding: 1rem 1rem 1rem 3.7rem; + color: white; +} + + .blazor-error-boundary::after { + content: "An error has occurred." + } \ No newline at end of file diff --git a/tests/Application.IntegrationTests/Application.IntegrationTests.csproj b/tests/Application.IntegrationTests/Application.IntegrationTests.csproj index 287074185..58d477c6d 100644 --- a/tests/Application.IntegrationTests/Application.IntegrationTests.csproj +++ b/tests/Application.IntegrationTests/Application.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 CleanArchitecture.Blazor.Application.IntegrationTests CleanArchitecture.Blazor.Application.IntegrationTests @@ -23,11 +23,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/tests/Application.UnitTests/Application.UnitTests.csproj b/tests/Application.UnitTests/Application.UnitTests.csproj index 9db132fbc..2be80d4c6 100644 --- a/tests/Application.UnitTests/Application.UnitTests.csproj +++ b/tests/Application.UnitTests/Application.UnitTests.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 CleanArchitecture.Blazor.Application.UnitTests CleanArchitecture.Blazor.Application.UnitTests @@ -13,11 +13,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/tests/Domain.UnitTests/Domain.UnitTests.csproj b/tests/Domain.UnitTests/Domain.UnitTests.csproj index 8f0b073b9..2a3ee6a2c 100644 --- a/tests/Domain.UnitTests/Domain.UnitTests.csproj +++ b/tests/Domain.UnitTests/Domain.UnitTests.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 CleanArchitecture.Blazor.Domain.UnitTests CleanArchitecture.Blazor.Domain.UnitTests @@ -14,11 +14,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - +