Yes, I saw while you connected that mvc looks ok. I wait some news from you regarding Angular then, thank for your support
Is there anyone following this ticket? I am stuck on my migration since about 10 days now and I still have no clue on how or when I will complete it...
Thank you
by adding this on angular, it is working now.
However, when I go to https://localhost:44367/Account/Login it remain in english, then after login, I go back to Angular in Spanish. If I am right, it is related to this ticket: https://support.abp.io/QA/Questions/1324/How-to-change-language-of-login-page-when-user-changes-language-of-application
Thanks
I still have the issue that if I go directly to this page https://localhost:44367/Account/Login, I will not have the language I want. I will see if it is part of our requirements. By the way, to make Angular working, I added the changes on Angular code but had to remove all the code suggested in .NET.
Hello maliming,
You are right, I removed all changes mentionned for .net project before and just put changes on the angular part.
So now when I run the angular page, I got the Finnish language and can change perfectly.
I tried your changes but several parts were wrong on the code, I then changed like this:
1- Remove b.HasOne<AppUser>().WithMany().HasForeignKey(x => x.AppUserId); in YourDbContextModelCreatingExtensions. → OK
2- Open *MigrationsDbContext, add the following code in the OnModelCreating method:
b.Ignore(x => x.AppUser); //Replace by AppUserId as AppUser does not exists
builder.Entity<IdentityUser>(b => { b.Property<Guid?>(nameof(AppUser.MyExistingEntityId)); //Replace by Id as MyExistingEntityId does not exists b.HasOne<MyExistingEntity>().WithMany().HasForeignKey(nameof(AppUser.MyExistingEntityId)); //Replace by Id as MyExistingEntityId does not exists });
3- Open *DbContext, add the following code in the OnModelCreating method:
b.Property<Guid?>(nameof(AppUser.OrganizationId)); //Replace by Id as OrganizationId does not exists
b.HasOne<MyExistingEntity>().WithMany().HasForeignKey(nameof(AppUser.MyExistingEntityId)); //Replace by Id as MyExistingEntityId does not exists
builder.ConfigureCustomApplicationModules(); // Commented it as I do not have this method I have this instead, but seems the same: builder.ConfigureMyApp();
I guess all the part builder.Entity<Test> was for test? I did try to add it but I do not know what to put to make it working...
After making this changes I then try to create migration files but I got this error:
The property 'Id' cannot be added to type 'IdentityUser' because the type of the corresponding CLR property or field 'string' does not match the specified type 'Nullable<Guid>'
Please keep me updated, I am available for remote connection, it might be faster to solve this than the way we do actually.
Thanks
With this, I got this error:
The relationship from 'StaffProfile' to 'IdentityUser' with foreign key properties {'AppUserId' : Nullable<Guid>} cannot target the primary key {'Id' : string} because it is not compatible. Configure a principal key or a set of compatible foreign key properties for this relationship.
So I tested by creating another field for the primary key in my ExistProfile entity:
public string AppUserIdString { get; set; }
It then generate a script but it is not what I want:
it create a new column, I want to keep AppUserId as it is in production already, i can not change the type. Plus if I want to change the type, I need to change a lot of code
the script create a new table IdentityUser, we are actually using ABPUser table, we can not use another.
Issue resolved.
After getting the error, everything is generated (UI, back-end) appart of the migration of the migration file.
To go further, some changes need to be done on our code:
1- *DbContextModelCreatingExtensions.cs file:
From the entity you generated, delete this line:
b.HasOne<AppUser>().WithMany().HasForeignKey(x => x.AppUserId);
2- On EntityGenerated.cs, add:
public AppUser AppUser { get; set; }
3- On AppUser.cs, add:
public EntityGenerated EntityGenerated { get; set; }
4- On OnModelCreating method of *MigrationDbContext.cs, add:
builder.Entity<EntityGenerated >(b =>
{
b.Ignore(x => x.AppUser);
b.HasOne<IdentityUser>().WithOne().HasForeignKey<EntityGenerated >(x => x.AppUserId);
});
NOTE: Be very careful to use Volo.Abp.Identity.IdentityUser for IdentityUser, by using Microsoft.AspNetCore.Identity.IdentityUser it will not work
5- On OnModelCreating method of *DbContext.cs, add:
builder.Entity<EntityGenerated>(b =>
{
b.HasOne(x => x.AppUser).WithOne(x => x.EntityGenerated).HasForeignKey<EntityGenerated>(x => x.AppUserId);
});
Once everything is done, you can now generate the migration script and update the database.
Thanks again Liangshiwei for your support
I got a similar issue and got it fixed there:
https://support.abp.io/QA/Questions/1343