655 messaggi dal 18 febbraio 2002
www.dimsolutions.it
Ho provato questa soluzione ma niente ottengo lo stesso errore:

        protected override void OnModelCreating(ModelBuilder builder) {
            base.OnModelCreating(builder);

            // per BUG MySQL in compilazione
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityUser>(entity => entity.Property(m => m.Id).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityUser>(entity => entity.Property(m => m.NormalizedEmail).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityUser>(entity => entity.Property(m => m.NormalizedUserName).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityRole>(entity => entity.Property(m => m.Id).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityRole>(entity => entity.Property(m => m.NormalizedName).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityUserLogin<string>>(entity => entity.Property(m => m.LoginProvider).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityUserLogin<string>>(entity => entity.Property(m => m.ProviderKey).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityUserLogin<string>>(entity => entity.Property(m => m.UserId).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityUserRole<string>>(entity => entity.Property(m => m.UserId).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityUserRole<string>>(entity => entity.Property(m => m.RoleId).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityUserToken<string>>(entity => entity.Property(m => m.UserId).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityUserToken<string>>(entity => entity.Property(m => m.LoginProvider).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityUserToken<string>>(entity => entity.Property(m => m.Name).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityUserClaim<string>>(entity => entity.Property(m => m.Id).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityUserClaim<string>>(entity => entity.Property(m => m.UserId).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>>(entity => entity.Property(m => m.Id).HasMaxLength(85));
            builder.Entity<Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>>(entity => entity.Property(m => m.RoleId).HasMaxLength(85));

            builder
                .Entity<UserAddress>(entityBuilder =>
                {
                    entityBuilder.ToTable("UserAddresses");
                    entityBuilder
                        .HasOne<ApplicationUser>()
                        .WithMany(user => user.Addresses)
                        .HasForeignKey(userAddress => userAddress.UserId)
                        .OnDelete(DeleteBehavior.Cascade);
                })

                .Entity<ApplicationUser>().ToTable("NomeTabellaUtenti");

            /*builder.Entity<ApplicationUser>()
                .Property(u => u.Id)
                .HasMaxLength(36);*/

            //Esatto, quindi dopo aver aggiunto la chiamata al.ToTable("NomeTabellaUtenti"), aggiungi ed esegui una migration in Console Gestione Pacchetti in questo modo:
            //PM> dotnet ef migrations add "RenamedUserTable"
            //PM> dotnet ef database update

        }


      CREATE UNIQUE INDEX `RoleNameIndex` ON `AspNetRoles` (`NormalizedName`);
MySql.Data.MySqlClient.MySqlException (0x80004005): Specified key was too long; max key length is 767 bytes ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Specified key was too long; max key length is 767 bytes
   at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in C:\projects\mysqlconnector\src\MySqlConnector\Core\ResultSet.cs:line 42
   at MySql.Data.MySqlClient.MySqlDataReader.ActivateResultSet(ResultSet resultSet) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlDataReader.cs:line 80
   at MySql.Data.MySqlClient.MySqlDataReader.ReadFirstResultSetAsync(IOBehavior ioBehavior) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlDataReader.cs:line 302

Telesoccorso Lineaperta: Servizi di Telesoccorso

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.