From 03df1b25a9f1ecebae1fd3f2aeba4fb65f02e386 Mon Sep 17 00:00:00 2001 From: David Eggenberger Date: Sat, 30 Nov 2024 23:37:50 +0100 Subject: [PATCH] execute migrations with DbUp --- .../DomainFeatures/Channels/Message.cs | 5 +- .../Client/Modules.Channels.Web.Client.csproj | 1 - .../Server/Controllers/ChannelsController.cs | 8 +- .../Server/Modules.Channels.Web.Server.csproj | 1 - .../EFCore/TenantIdentityDbContext.cs | 1 - .../0001_TenantIdentity_Initial.sql | 228 ++++++++++++++++++ .../Features/EFCore/DbUp/Registrator.cs | 41 ++++ Source/Shared/Features/Shared.Features.csproj | 1 + .../Auth/HostAuthenticationStateProvider.cs | 1 + .../MainLayoutMenu/TeamsOverviewComp.razor.cs | 6 +- Source/Web/Client/Pages/Dashboard.razor.cs | 6 +- Source/Web/Client/Pages/Topic.razor.cs | 38 +-- Source/Web/Client/_Imports.razor | 1 - .../ModelValidation/Registrator.cs | 2 +- 14 files changed, 304 insertions(+), 36 deletions(-) create mode 100644 Source/Shared/Features/EFCore/DbUp/Migrations/0001_TenantIdentity_Initial.sql create mode 100644 Source/Shared/Features/EFCore/DbUp/Registrator.cs diff --git a/Source/Modules/Channels/Features/DomainFeatures/Channels/Message.cs b/Source/Modules/Channels/Features/DomainFeatures/Channels/Message.cs index e3fc0a61..da43dbae 100644 --- a/Source/Modules/Channels/Features/DomainFeatures/Channels/Message.cs +++ b/Source/Modules/Channels/Features/DomainFeatures/Channels/Message.cs @@ -1,6 +1,5 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore; -using Modules.Channels.Features.DomainFeatures.Channels.Events; using Shared.Features.Domain; namespace Modules.Channels.Features.DomainFeatures.Channels @@ -19,14 +18,14 @@ public class Message : Entity public List MakeMessageTopicVotes => votes; internal void AddVote(Reaction vote) { - if (votes.Any(v => v.CreatedByUserId == vote.CreatedByUserId) is false) + if (votes.Any(v => v.UserId == vote.UserId) is false) { votes.Add(vote); } } internal void RemoveVote(Reaction vote) { - votes.Remove(votes.FirstOrDefault(v => v.CreatedByUserId == vote.CreatedByUserId)); + votes.Remove(votes.FirstOrDefault(v => v.UserId == vote.UserId)); } } diff --git a/Source/Modules/Channels/Web/Client/Modules.Channels.Web.Client.csproj b/Source/Modules/Channels/Web/Client/Modules.Channels.Web.Client.csproj index b2b77c3b..c147b50c 100644 --- a/Source/Modules/Channels/Web/Client/Modules.Channels.Web.Client.csproj +++ b/Source/Modules/Channels/Web/Client/Modules.Channels.Web.Client.csproj @@ -18,7 +18,6 @@ - diff --git a/Source/Modules/Channels/Web/Server/Controllers/ChannelsController.cs b/Source/Modules/Channels/Web/Server/Controllers/ChannelsController.cs index 73e091b2..2bf8fa06 100644 --- a/Source/Modules/Channels/Web/Server/Controllers/ChannelsController.cs +++ b/Source/Modules/Channels/Web/Server/Controllers/ChannelsController.cs @@ -39,16 +39,16 @@ public async Task GetChannelById([FromRoute] Guid id, Cancellation [HttpPost] public async Task CreateChannel([FromBody] ChannelDTO createChannelDTO, CancellationToken cancellationToken) { - var createChannelCommand = mapper.Map(createChannelDTO); - await commandDispatcher.DispatchAsync(createChannelCommand, cancellationToken); + //var createChannelCommand = mapper.Map(createChannelDTO); + //await commandDispatcher.DispatchAsync(createChannelCommand, cancellationToken); } [HttpPut("{id}")] [AuthorizeTenantAdmin] public async Task UpdateChannel([FromBody] ChannelDTO updateChannelDTO, CancellationToken cancellationToken) { - ChangeChannelName updateChannelCommand = mapper.Map(updateChannelDTO); - await commandDispatcher.DispatchAsync(updateChannelCommand, cancellationToken); + //ChangeChannelName updateChannelCommand = mapper.Map(updateChannelDTO); + //await commandDispatcher.DispatchAsync(updateChannelCommand, cancellationToken); } //[HttpPost("createMessage")] diff --git a/Source/Modules/Channels/Web/Server/Modules.Channels.Web.Server.csproj b/Source/Modules/Channels/Web/Server/Modules.Channels.Web.Server.csproj index 401fe178..a854a281 100644 --- a/Source/Modules/Channels/Web/Server/Modules.Channels.Web.Server.csproj +++ b/Source/Modules/Channels/Web/Server/Modules.Channels.Web.Server.csproj @@ -18,7 +18,6 @@ - diff --git a/Source/Modules/TenantIdentity/Features/Modules.TenantIdentity.Features/Infrastructure/EFCore/TenantIdentityDbContext.cs b/Source/Modules/TenantIdentity/Features/Modules.TenantIdentity.Features/Infrastructure/EFCore/TenantIdentityDbContext.cs index f09a2a0d..d04adf88 100644 --- a/Source/Modules/TenantIdentity/Features/Modules.TenantIdentity.Features/Infrastructure/EFCore/TenantIdentityDbContext.cs +++ b/Source/Modules/TenantIdentity/Features/Modules.TenantIdentity.Features/Infrastructure/EFCore/TenantIdentityDbContext.cs @@ -97,7 +97,6 @@ public async Task GetTenantExtendedByIdAsync(Guid tenantId) var tenant = await Tenants .Include(t => t.Memberships) .Include(t => t.Invitations) - .Include(t => t.TenantSubscriptions) .FirstOrDefaultAsync(t => t.TenantId == tenantId); if (tenant == null) { diff --git a/Source/Shared/Features/EFCore/DbUp/Migrations/0001_TenantIdentity_Initial.sql b/Source/Shared/Features/EFCore/DbUp/Migrations/0001_TenantIdentity_Initial.sql new file mode 100644 index 00000000..7c4b1c6b --- /dev/null +++ b/Source/Shared/Features/EFCore/DbUp/Migrations/0001_TenantIdentity_Initial.sql @@ -0,0 +1,228 @@ +IF OBJECT_ID(N'[MigrationHistory_TenantIdentity]') IS NULL +BEGIN + CREATE TABLE [MigrationHistory_TenantIdentity] ( + [MigrationId] nvarchar(150) NOT NULL, + [ProductVersion] nvarchar(32) NOT NULL, + CONSTRAINT [PK_MigrationHistory_TenantIdentity] PRIMARY KEY ([MigrationId]) + ); +END; +GO + +BEGIN TRANSACTION; +GO + +IF SCHEMA_ID(N'Identity') IS NULL EXEC(N'CREATE SCHEMA [Identity];'); +GO + +CREATE TABLE [Identity].[AspNetRoles] ( + [Id] uniqueidentifier NOT NULL, + [Name] nvarchar(256) NULL, + [NormalizedName] nvarchar(256) NULL, + [ConcurrencyStamp] nvarchar(max) NULL, + CONSTRAINT [PK_AspNetRoles] PRIMARY KEY ([Id]) +); +GO + +CREATE TABLE [Identity].[AspNetUsers] ( + [Id] uniqueidentifier NOT NULL, + [PictureUri] nvarchar(max) NULL, + [CountOfOpenTabs] int NOT NULL, + [SelectedTenantId] uniqueidentifier NOT NULL, + [UserName] nvarchar(256) NULL, + [NormalizedUserName] nvarchar(256) NULL, + [Email] nvarchar(256) NULL, + [NormalizedEmail] nvarchar(256) NULL, + [EmailConfirmed] bit NOT NULL, + [PasswordHash] nvarchar(max) NULL, + [SecurityStamp] nvarchar(max) NULL, + [ConcurrencyStamp] nvarchar(max) NULL, + [PhoneNumber] nvarchar(max) NULL, + [PhoneNumberConfirmed] bit NOT NULL, + [TwoFactorEnabled] bit NOT NULL, + [LockoutEnd] datetimeoffset NULL, + [LockoutEnabled] bit NOT NULL, + [AccessFailedCount] int NOT NULL, + CONSTRAINT [PK_AspNetUsers] PRIMARY KEY ([Id]) +); +GO + +CREATE TABLE [Identity].[TenantSettings] ( + [Id] uniqueidentifier NOT NULL, + [IconURI] nvarchar(max) NULL, + [CreatedByUserId] uniqueidentifier NOT NULL, + [IsSoftDeleted] bit NOT NULL, + [RowVersion] varbinary(max) NULL, + [CreatedAt] datetimeoffset NOT NULL, + [LastUpdatedAt] datetimeoffset NOT NULL, + [IsDeleted] bit NOT NULL, + CONSTRAINT [PK_TenantSettings] PRIMARY KEY ([Id]) +); +GO + +CREATE TABLE [Identity].[TenantStylings] ( + [Id] uniqueidentifier NOT NULL, + [CreatedByUserId] uniqueidentifier NOT NULL, + [IsSoftDeleted] bit NOT NULL, + [RowVersion] varbinary(max) NULL, + [CreatedAt] datetimeoffset NOT NULL, + [LastUpdatedAt] datetimeoffset NOT NULL, + [IsDeleted] bit NOT NULL, + CONSTRAINT [PK_TenantStylings] PRIMARY KEY ([Id]) +); +GO + +CREATE TABLE [Identity].[AspNetRoleClaims] ( + [Id] int NOT NULL IDENTITY, + [RoleId] uniqueidentifier NOT NULL, + [ClaimType] nvarchar(max) NULL, + [ClaimValue] nvarchar(max) NULL, + CONSTRAINT [PK_AspNetRoleClaims] PRIMARY KEY ([Id]), + CONSTRAINT [FK_AspNetRoleClaims_AspNetRoles_RoleId] FOREIGN KEY ([RoleId]) REFERENCES [Identity].[AspNetRoles] ([Id]) ON DELETE CASCADE +); +GO + +CREATE TABLE [Identity].[AspNetUserClaims] ( + [Id] int NOT NULL IDENTITY, + [UserId] uniqueidentifier NOT NULL, + [ClaimType] nvarchar(max) NULL, + [ClaimValue] nvarchar(max) NULL, + [ApplicationUserId] uniqueidentifier NULL, + CONSTRAINT [PK_AspNetUserClaims] PRIMARY KEY ([Id]), + CONSTRAINT [FK_AspNetUserClaims_AspNetUsers_ApplicationUserId] FOREIGN KEY ([ApplicationUserId]) REFERENCES [Identity].[AspNetUsers] ([Id]), + CONSTRAINT [FK_AspNetUserClaims_AspNetUsers_UserId] FOREIGN KEY ([UserId]) REFERENCES [Identity].[AspNetUsers] ([Id]) ON DELETE CASCADE +); +GO + +CREATE TABLE [Identity].[AspNetUserLogins] ( + [LoginProvider] nvarchar(128) NOT NULL, + [ProviderKey] nvarchar(128) NOT NULL, + [ProviderDisplayName] nvarchar(max) NULL, + [UserId] uniqueidentifier NOT NULL, + [ApplicationUserId] uniqueidentifier NULL, + CONSTRAINT [PK_AspNetUserLogins] PRIMARY KEY ([LoginProvider], [ProviderKey]), + CONSTRAINT [FK_AspNetUserLogins_AspNetUsers_ApplicationUserId] FOREIGN KEY ([ApplicationUserId]) REFERENCES [Identity].[AspNetUsers] ([Id]), + CONSTRAINT [FK_AspNetUserLogins_AspNetUsers_UserId] FOREIGN KEY ([UserId]) REFERENCES [Identity].[AspNetUsers] ([Id]) ON DELETE CASCADE +); +GO + +CREATE TABLE [Identity].[AspNetUserRoles] ( + [UserId] uniqueidentifier NOT NULL, + [RoleId] uniqueidentifier NOT NULL, + CONSTRAINT [PK_AspNetUserRoles] PRIMARY KEY ([UserId], [RoleId]), + CONSTRAINT [FK_AspNetUserRoles_AspNetRoles_RoleId] FOREIGN KEY ([RoleId]) REFERENCES [Identity].[AspNetRoles] ([Id]) ON DELETE CASCADE, + CONSTRAINT [FK_AspNetUserRoles_AspNetUsers_UserId] FOREIGN KEY ([UserId]) REFERENCES [Identity].[AspNetUsers] ([Id]) ON DELETE CASCADE +); +GO + +CREATE TABLE [Identity].[AspNetUserTokens] ( + [UserId] uniqueidentifier NOT NULL, + [LoginProvider] nvarchar(128) NOT NULL, + [Name] nvarchar(128) NOT NULL, + [Value] nvarchar(max) NULL, + [ApplicationUserId] uniqueidentifier NULL, + CONSTRAINT [PK_AspNetUserTokens] PRIMARY KEY ([UserId], [LoginProvider], [Name]), + CONSTRAINT [FK_AspNetUserTokens_AspNetUsers_ApplicationUserId] FOREIGN KEY ([ApplicationUserId]) REFERENCES [Identity].[AspNetUsers] ([Id]), + CONSTRAINT [FK_AspNetUserTokens_AspNetUsers_UserId] FOREIGN KEY ([UserId]) REFERENCES [Identity].[AspNetUsers] ([Id]) ON DELETE CASCADE +); +GO + +CREATE TABLE [Identity].[Tenants] ( + [Id] uniqueidentifier NOT NULL, + [TenantId] uniqueidentifier NOT NULL, + [Name] nvarchar(max) NULL, + [StylingId] uniqueidentifier NULL, + [SettingsId] uniqueidentifier NULL, + [SubscriptionPlanType] int NOT NULL, + [CreatedByUserId] uniqueidentifier NOT NULL, + [IsSoftDeleted] bit NOT NULL, + [RowVersion] varbinary(max) NULL, + [CreatedAt] datetimeoffset NOT NULL, + [LastUpdatedAt] datetimeoffset NOT NULL, + [IsDeleted] bit NOT NULL, + CONSTRAINT [PK_Tenants] PRIMARY KEY ([Id]), + CONSTRAINT [FK_Tenants_TenantSettings_SettingsId] FOREIGN KEY ([SettingsId]) REFERENCES [Identity].[TenantSettings] ([Id]), + CONSTRAINT [FK_Tenants_TenantStylings_StylingId] FOREIGN KEY ([StylingId]) REFERENCES [Identity].[TenantStylings] ([Id]) +); +GO + +CREATE TABLE [Identity].[TenantInvitations] ( + [TenantId] uniqueidentifier NOT NULL, + [UserId] uniqueidentifier NOT NULL, + [Role] int NOT NULL, + CONSTRAINT [FK_TenantInvitations_AspNetUsers_UserId] FOREIGN KEY ([UserId]) REFERENCES [Identity].[AspNetUsers] ([Id]) ON DELETE CASCADE, + CONSTRAINT [FK_TenantInvitations_Tenants_TenantId] FOREIGN KEY ([TenantId]) REFERENCES [Identity].[Tenants] ([Id]) ON DELETE CASCADE +); +GO + +CREATE TABLE [Identity].[TenantMeberships] ( + [Id] uniqueidentifier NOT NULL, + [UserId] uniqueidentifier NOT NULL, + [TenantId] uniqueidentifier NULL, + [Role] int NOT NULL, + [ApplicationUserId] uniqueidentifier NULL, + [CreatedByUserId] uniqueidentifier NOT NULL, + [IsSoftDeleted] bit NOT NULL, + [RowVersion] varbinary(max) NULL, + [CreatedAt] datetimeoffset NOT NULL, + [LastUpdatedAt] datetimeoffset NOT NULL, + [IsDeleted] bit NOT NULL, + CONSTRAINT [PK_TenantMeberships] PRIMARY KEY ([Id]), + CONSTRAINT [FK_TenantMeberships_AspNetUsers_ApplicationUserId] FOREIGN KEY ([ApplicationUserId]) REFERENCES [Identity].[AspNetUsers] ([Id]), + CONSTRAINT [FK_TenantMeberships_Tenants_TenantId] FOREIGN KEY ([TenantId]) REFERENCES [Identity].[Tenants] ([Id]) +); +GO + +CREATE INDEX [IX_AspNetRoleClaims_RoleId] ON [Identity].[AspNetRoleClaims] ([RoleId]); +GO + +CREATE UNIQUE INDEX [RoleNameIndex] ON [Identity].[AspNetRoles] ([NormalizedName]) WHERE [NormalizedName] IS NOT NULL; +GO + +CREATE INDEX [IX_AspNetUserClaims_ApplicationUserId] ON [Identity].[AspNetUserClaims] ([ApplicationUserId]); +GO + +CREATE INDEX [IX_AspNetUserClaims_UserId] ON [Identity].[AspNetUserClaims] ([UserId]); +GO + +CREATE INDEX [IX_AspNetUserLogins_ApplicationUserId] ON [Identity].[AspNetUserLogins] ([ApplicationUserId]); +GO + +CREATE INDEX [IX_AspNetUserLogins_UserId] ON [Identity].[AspNetUserLogins] ([UserId]); +GO + +CREATE INDEX [IX_AspNetUserRoles_RoleId] ON [Identity].[AspNetUserRoles] ([RoleId]); +GO + +CREATE INDEX [EmailIndex] ON [Identity].[AspNetUsers] ([NormalizedEmail]); +GO + +CREATE UNIQUE INDEX [UserNameIndex] ON [Identity].[AspNetUsers] ([NormalizedUserName]) WHERE [NormalizedUserName] IS NOT NULL; +GO + +CREATE INDEX [IX_AspNetUserTokens_ApplicationUserId] ON [Identity].[AspNetUserTokens] ([ApplicationUserId]); +GO + +CREATE INDEX [IX_TenantInvitations_TenantId] ON [Identity].[TenantInvitations] ([TenantId]); +GO + +CREATE INDEX [IX_TenantInvitations_UserId] ON [Identity].[TenantInvitations] ([UserId]); +GO + +CREATE INDEX [IX_TenantMeberships_ApplicationUserId] ON [Identity].[TenantMeberships] ([ApplicationUserId]); +GO + +CREATE INDEX [IX_TenantMeberships_TenantId] ON [Identity].[TenantMeberships] ([TenantId]); +GO + +CREATE INDEX [IX_Tenants_SettingsId] ON [Identity].[Tenants] ([SettingsId]); +GO + +CREATE INDEX [IX_Tenants_StylingId] ON [Identity].[Tenants] ([StylingId]); +GO + +INSERT INTO [MigrationHistory_TenantIdentity] ([MigrationId], [ProductVersion]) +VALUES (N'20240210092230_initial', N'8.0.1'); +GO + +COMMIT; +GO \ No newline at end of file diff --git a/Source/Shared/Features/EFCore/DbUp/Registrator.cs b/Source/Shared/Features/EFCore/DbUp/Registrator.cs new file mode 100644 index 00000000..0fb00c12 --- /dev/null +++ b/Source/Shared/Features/EFCore/DbUp/Registrator.cs @@ -0,0 +1,41 @@ +using DbUp; +using Microsoft.Data.SqlClient; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Shared.Features.EFCore.Configuration; +using Shared.Kernel.BuildingBlocks; +using System.Reflection; + +namespace Shared.Features.EFCore.DbUp +{ + public static class Registrator + { + public static async Task AddDbUpMigration(this IServiceCollection services) + { + using var serviceProvider = services.BuildServiceProvider(); + + var isProduction = serviceProvider.GetRequiredService().HostingEnvironment.IsProduction(); + var efCoreConfiguration = serviceProvider.GetRequiredService(); + var connectionString = isProduction ? efCoreConfiguration.SQLServerConnectionString_Prod : efCoreConfiguration.SQLServerConnectionString_Dev; + + EnsureDatabase.For.SqlDatabase(connectionString); + + var upgrader = DeployChanges.To + .SqlDatabase(connectionString) + .WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly()) + .JournalToSqlTable("dbo", "MigrationHistory_DbUP") + .LogToConsole() + .Build(); + + var scripts = upgrader.GetScriptsToExecute(); + foreach (var script in scripts) + { + Console.WriteLine(script.Name); + } + + upgrader.PerformUpgrade(); + + return services; + } + } +} diff --git a/Source/Shared/Features/Shared.Features.csproj b/Source/Shared/Features/Shared.Features.csproj index 3896604c..bed0b0f4 100644 --- a/Source/Shared/Features/Shared.Features.csproj +++ b/Source/Shared/Features/Shared.Features.csproj @@ -12,6 +12,7 @@ + diff --git a/Source/Web/Client/BuildingBlocks/Auth/HostAuthenticationStateProvider.cs b/Source/Web/Client/BuildingBlocks/Auth/HostAuthenticationStateProvider.cs index a5986e63..a4883e7d 100644 --- a/Source/Web/Client/BuildingBlocks/Auth/HostAuthenticationStateProvider.cs +++ b/Source/Web/Client/BuildingBlocks/Auth/HostAuthenticationStateProvider.cs @@ -7,6 +7,7 @@ using Web.Web.Client.BuildingBlocks.Authentication.Antiforgery; using Shared.Kernel.BuildingBlocks.Auth.Constants; using Modules.TenantIdentity.Shared.DTOs; +using Modules.TenantIdentity.Shared.DTOs.IdentityOperations; namespace Web.Web.Client.BuildingBlocks.Authentication { diff --git a/Source/Web/Client/BuildingBlocks/Layouts/MainLayoutMenu/TeamsOverviewComp.razor.cs b/Source/Web/Client/BuildingBlocks/Layouts/MainLayoutMenu/TeamsOverviewComp.razor.cs index 21196ba5..fa87a5f8 100644 --- a/Source/Web/Client/BuildingBlocks/Layouts/MainLayoutMenu/TeamsOverviewComp.razor.cs +++ b/Source/Web/Client/BuildingBlocks/Layouts/MainLayoutMenu/TeamsOverviewComp.razor.cs @@ -1,14 +1,14 @@ -using Modules.TenantIdentity.Shared.DTOs.Team; +using Modules.TenantIdentity.Shared.DTOs.Tenant; using Shared.Client; namespace Web.Client.Layouts.MainLayoutMenu { public partial class TeamsOverviewComponentBase : BaseComponent { - protected IEnumerable teams; + protected IEnumerable teams; protected override async Task OnInitializedAsync() { - teams = await httpClientService.GetFromAPIAsync>("/user/allTeams"); + teams = await httpClientService.GetFromAPIAsync>("/user/allTeams"); } protected bool expanded = true; public void Click() diff --git a/Source/Web/Client/Pages/Dashboard.razor.cs b/Source/Web/Client/Pages/Dashboard.razor.cs index 0985615b..0b566cce 100644 --- a/Source/Web/Client/Pages/Dashboard.razor.cs +++ b/Source/Web/Client/Pages/Dashboard.razor.cs @@ -1,5 +1,5 @@ using Microsoft.AspNetCore.Components; -using Modules.TenantIdentity.Shared.DTOs.Team; +using Modules.TenantIdentity.Shared.DTOs.Tenant; using Shared.Client; using Shared.Kernel.BuildingBlocks.Services.Http; @@ -9,11 +9,11 @@ public partial class Dashboard : BaseComponent { [Inject] public HttpClientService httpClientService { get; set; } - public List Teams { get; set; } + public List Teams { get; set; } protected override async Task OnInitializedAsync() { - Teams = await httpClientService.GetFromAPIAsync>("api/Team/all"); + Teams = await httpClientService.GetFromAPIAsync>("api/Team/all"); } } } diff --git a/Source/Web/Client/Pages/Topic.razor.cs b/Source/Web/Client/Pages/Topic.razor.cs index b611ed7c..bf19c3a5 100644 --- a/Source/Web/Client/Pages/Topic.razor.cs +++ b/Source/Web/Client/Pages/Topic.razor.cs @@ -1,4 +1,6 @@ using Blazor.Diagrams.Core; +using Blazor.Diagrams.Core.Options; +using Blazor.Diagrams.Options; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; @@ -12,26 +14,26 @@ public partial class Topic protected override async Task OnInitializedAsync() { - var options = new DiagramOptions - { - DeleteKey = "Delete", - DefaultNodeComponent = null, - AllowMultiSelection = true, - AllowPanning = false, - Zoom = new DiagramZoomOptions - { - Enabled = false - }, - Links = new DiagramLinkOptions - { - DefaultColor = "white" - } - }; - diagram = new Diagram(options); + //var options = new BlazorDiagramOptions + //{ + // DeleteKey = "Delete", + // DefaultNodeComponent = null, + // AllowMultiSelection = true, + // AllowPanning = false, + // Zoom = new DiagramZoomOptions + // { + // Enabled = false + // }, + // Links = new DiagramLinkOptions + // { + // DefaultColor = "white" + // } + //}; + //diagram = new Diagram(options); - StateHasChanged(); - await Task.Delay(100); + //StateHasChanged(); + //await Task.Delay(100); } public void OnDrop(DragEventArgs e) diff --git a/Source/Web/Client/_Imports.razor b/Source/Web/Client/_Imports.razor index 8283d7d7..adef5d6a 100644 --- a/Source/Web/Client/_Imports.razor +++ b/Source/Web/Client/_Imports.razor @@ -23,6 +23,5 @@ @using Blazor.Diagrams.Core.Models @using Blazor.Diagrams.Components @using Blazor.Diagrams.Core.Geometry -@using Web.Client.Pages @using Shared.Client @using Shared.Kernel.Constants.Modules \ No newline at end of file diff --git a/Source/Web/Server/BuildingBlocks/ModelValidation/Registrator.cs b/Source/Web/Server/BuildingBlocks/ModelValidation/Registrator.cs index 7eaf1883..bb2feeea 100644 --- a/Source/Web/Server/BuildingBlocks/ModelValidation/Registrator.cs +++ b/Source/Web/Server/BuildingBlocks/ModelValidation/Registrator.cs @@ -9,7 +9,7 @@ public static class Registrator { public static IServiceCollection AddModelValidation(this IServiceCollection services) { - services.RegisterModelValidationService(); + services.AddScoped(); return services.Configure(options => {