Ends in:
2 DAYS
2 HRS
39 MIN
17 SEC
Ends in:
2 D
2 H
39 M
17 S
Open Closed

Upgrade from 6.0.0 to 7.3.2 #5793


User avatar
0
aqudah81 created
  • ABP Framework version: v6.0.0
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hello Support team , We upgraded from v6 to v 7.3.2 using abp update command , I have now error when I tried to login on Auth server using this command :

      var result = await SignInManager.PasswordSignInAsync(
          LoginInput.UserNameOrEmailAddress,
          LoginInput.Password,
          LoginInput.RememberMe,
          true
      );

I got this error on attached image , you can also find below the stack trace for the System.ArgumentNullException:

System.ArgumentNullException
  HResult=0x80004003
  Message=Value cannot be null. Arg_ParamName_Name
  Source=System.Linq
  StackTrace:
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument) in System.Linq\ThrowHelper.cs:line 10
   at System.Linq.Enumerable.SequenceEqual[TSource](IEnumerable`1 first, IEnumerable`1 second, IEqualityComparer`1 comparer) in System.Linq\Enumerable.cs:line 6938
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.GetCurrentValue[TProperty](IPropertyBase propertyBase) in /_/src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs:line 910
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.EnsureOriginalValues() in /_/src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs:line 1142
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntrySubscriber.SnapshotAndSubscribe(InternalEntityEntry entry) in /_/src/EFCore/ChangeTracking/Internal/InternalEntityEntrySubscriber.cs:line 32
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTrackingFromQuery(IEntityType baseEntityType, Object entity, ValueBuffer& valueBuffer) in /_/src/EFCore/ChangeTracking/Internal/StateManager.cs:line 359
   at Microsoft.EntityFrameworkCore.Query.QueryContext.StartTracking(IEntityType entityType, Object entity, ValueBuffer valueBuffer) in /_/src/EFCore/Query/QueryContext.cs:line 147
   at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.<MoveNextAsync>d__21.MoveNext() in Microsoft.EntityFrameworkCore.Query.Internal\SplitQueryingEnumerable.cs:line 219
   at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1.ConfiguredValueTaskAwaiter.GetResult() in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/ConfiguredValueTaskAwaitable.cs:line 154
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.&lt;SingleOrDefaultAsync&gt;d__15`1.MoveNext() in /_/src/EFCore/Query/ShapedQueryCompilingExpressionVisitor.cs:line 159
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.<SingleOrDefaultAsync>d__15`1.MoveNext() in /_/src/EFCore/Query/ShapedQueryCompilingExpressionVisitor.cs:line 171
   at SanadCash.Expense.Users.ExtendedEfCoreIdentityUserRepository.&lt;FindByNormalizedUserNameAsync&gt;d__6.MoveNext() in D:\Projects\SanadCash.Expense\aspnet-core\src\SanadCash.Expense.EntityFrameworkCore\Users\ExtendedEfCoreIdentityUserRepository.cs:line 103

  This exception was originally thrown at this call stack:
    System.Linq.ThrowHelper.ThrowArgumentNullException(System.Linq.ExceptionArgument) in ThrowHelper.cs
    System.Linq.Enumerable.SequenceEqual&lt;TSource&gt;(System.Collections.Generic.IEnumerable&lt;TSource&gt;, System.Collections.Generic.IEnumerable&lt;TSource&gt;, System.Collections.Generic.IEqualityComparer&lt;TSource&gt;) in Enumerable.cs
    Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.GetCurrentValue&lt;TProperty&gt;(Microsoft.EntityFrameworkCore.Metadata.IPropertyBase) in InternalEntityEntry.cs
    Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.EnsureOriginalValues() in InternalEntityEntry.cs
    Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntrySubscriber.SnapshotAndSubscribe(Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry) in InternalEntityEntrySubscriber.cs
    Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTrackingFromQuery(Microsoft.EntityFrameworkCore.Metadata.IEntityType, object, Microsoft.EntityFrameworkCore.Storage.ValueBuffer) in StateManager.cs
    Microsoft.EntityFrameworkCore.Query.QueryContext.StartTracking(Microsoft.EntityFrameworkCore.Metadata.IEntityType, object, Microsoft.EntityFrameworkCore.Storage.ValueBuffer) in QueryContext.cs
    Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable&lt;T&gt;.AsyncEnumerator.MoveNextAsync() in SplitQueryingEnumerable.cs
    System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable&lt;TResult&gt;.ConfiguredValueTaskAwaiter.GetResult() in ConfiguredValueTaskAwaitable.cs
    Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync&lt;TSource&gt;(System.Collections.Generic.IAsyncEnumerable&lt;TSource&gt;, System.Threading.CancellationToken) in ShapedQueryCompilingExpressionVisitor.cs
    ...
    [Call Stack Truncated]


17 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    There are too many changes between 6.0 and 7.3.

    How can I reproduce this?

  • User Avatar
    0
    aqudah81 created

    Hi , Sure thing , you can find below steps to reproduce this issue :

    1- Go to the root of two projects and run run: abp update

    2- change <TargetFramework>net6.0</TargetFramework> --> <TargetFramework>net7.0</TargetFramework>

    3- Update many Microsoft DLL's to 7.0.0 like : Microsoft.Extensions.FileProviders.Embedded Microsoft.Extensions.Logging.Abstractions Microsoft.Extensions.Http Microsoft.Extensions.Options Microsoft.Extensions.Hosting

    6- Change standard project from <TargetFramework>netstandard2.0</TargetFramework> To <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>

    7- Renamed OnRegistered Method

    8 - Removed MultiTenancySides from permission groups #13755 //https://github.com/abpframework/abp/issues/13755

    9- Upgrade Volo.Abp.Autofac , Volo.Saas.Host.Application.Contracts and any missing Volo references to 7.3.3

    10 - Update below packages to 7.0.0 <PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="7.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="7.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="7.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="7.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.0" /> <PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="7.0.0" />

    10 - Add public DbSet<IdentityUserDelegation> UserDelegations { get; }

    11- Add migration and run the migration.

    12 - <PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="7.3.3" /> <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="7.3.3" /> <PackageReference Include="Volo.Abp.Account.Pro.Public.Application" Version="7.3.3" /> <PackageReference Include="Volo.Abp.Account.Pro.Public.HttpApi" Version="7.3.3" /> <PackageReference Include="Volo.Abp.Account.Pro.Public.Web.IdentityServer" Version="7.3.3" /> <PackageReference Include="Volo.Abp.Account.Pro.Public.Web.Impersonation" Version="7.3.3" /> <PackageReference Include="Volo.Abp.EventBus.Azure" Version="7.3.3" /> <PackageReference Include="Volo.Saas.Host.Application.Contracts" Version="7.3.3" />

    13- Upgrade EasyAbp.NotificationService.Provider.Mailing package to 2.3.0

    14 - update Volo.Abp.Account.Pro.Public.Web.IdentityServer to 7.3.2

    15- update microsoft.entityframeworkcore.tools to 7.0.1

    16 - upgrade Elsa , Elsa.Activities.UserTask and Elsa.Persistence.EntityFramework to 2.12.0

    17 - In IdentityServer project upgrade Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX To 2.3.3

    18 - Run the application and try to login from Auth server link , you will got this error : Thanks ******************************************************************************************************

    An unhandled exception occurred while processing the request. ArgumentNullException: Value cannot be null. (Parameter 'second') System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)

    Stack Query Cookies Headers Routing ArgumentNullException: Value cannot be null. (Parameter 'second') System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument) System.Linq.Enumerable.SequenceEqual<TSource>(IEnumerable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer) lambda_method2642(Closure , IUpdateEntry ) Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.GetCurrentValue<TProperty>(IPropertyBase propertyBase) lambda_method2584(Closure , InternalEntityEntry ) Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry+OriginalValues..ctor(InternalEntityEntry entry) Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.EnsureOriginalValues() Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntrySubscriber.SnapshotAndSubscribe(InternalEntityEntry entry) Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTrackingFromQuery(IEntityType baseEntityType, object entity, ref ValueBuffer valueBuffer) Microsoft.EntityFrameworkCore.Query.QueryContext.StartTracking(IEntityType entityType, object entity, ValueBuffer valueBuffer) lambda_method2526(Closure , QueryContext , DbDataReader , ResultContext , SplitQueryResultCoordinator ) Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable<T>+AsyncEnumerator.MoveNextAsync() System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<TResult>+ConfiguredValueTaskAwaiter.GetResult() Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync<TSource>(IAsyncEnumerable<TSource> asyncEnumerable, CancellationToken cancellationToken) Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync<TSource>(IAsyncEnumerable<TSource> asyncEnumerable, CancellationToken cancellationToken) Volo.Abp.Identity.EntityFrameworkCore.EfCoreIdentityUserRepository.FindByNormalizedUserNameAsync(string normalizedUserName, bool includeDetails, CancellationToken cancellationToken) Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo) Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue<TResult>.ProceedAsync() Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter<TInterceptor>.InterceptAsync<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func<IInvocation, IInvocationProceedInfo, Task<TResult>> proceed) Microsoft.AspNetCore.Identity.UserManager<TUser>.FindByNameAsync(string userName) Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo) Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue<TResult>.ProceedAsync() Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter<TInterceptor>.InterceptAsync<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func<IInvocation, IInvocationProceedInfo, Task<TResult>> proceed) Microsoft.AspNetCore.Identity.SignInManager<TUser>.PasswordSignInAsync(string userName, string password, bool isPersistent, bool lockoutOnFailure) Volo.Abp.Identity.AspNetCore.AbpSignInManager.PasswordSignInAsync(string userName, string password, bool isPersistent, bool lockoutOnFailure) SanadCash.Expense.Pages.Account.LoginModel.OnPostAsync(string action) in Login.cshtml.cs + var result = await SignInManager.PasswordSignInAsync( Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory+GenericTaskHandlerMethod.Convert<T>(object taskAsObject) Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory+GenericTaskHandlerMethod.Execute(object receiver, object[] arguments) Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync() Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync() Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context) Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync() Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker) Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events, IBackChannelLogoutService backChannelLogoutService) IdentityServer4.Hosting.MutualTlsEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes) Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context) Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Microsoft.AspNetCore.Builder.ApplicationBuilderAbpJwtTokenMiddlewareExtension+<>c__DisplayClass0_0+<<UseJwtTokenMiddleware>b__0>d.MoveNext() Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share your project, and I will run it on my locally.

    Thanks

    liming.ma@volosoft.com

  • User Avatar
    0
    aqudah81 created

    Hi ,

    I tried to prepare a project for Auth server that have this issue after remove our source code but the issue not appear . As you know I can't share our Company source code .

    So can make a remote session with you to investigate on issue on real sample with easy steps . We can make this session any time if you can and I hope it will take a small time.

    This is mt email : anasaq@sanadcash.com

    Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I think it can definitely reproduce the problem on your computer, But it is difficult to debug applications remotely. Can you first compare the code of the new and old projects?

  • User Avatar
    0
    aqudah81 created

    Hi , I can now reproduce the issue in clean instance for version 7.3.3 . The issue on AbpTestUpgrade733NewDbContext.cs in line 95 : b.ToTable(AbpAuditLoggingDbProperties.DbTablePrefix + "Users", AbpAuditLoggingDbProperties.DbSchema); If we comment this line the error will gone but we can't access IdentityUserView .

    I will attach two files . The first one aspnet-core-V6-AbpV-6.0.0 will have the working sample from our code using abp version 6.

    The second one aspnet-core-V7-AbpV-7.3.3 will have the working sample from our code using abp version 7.3.3. You can see the error on version 7.3.3 , also on file Index.cshtml.cs you will find a code to get data from **IdentityUser **entity and IdentityUserView

    Note: in **IdentityUser **entity and IdentityUserView we want to map these two entities to the same table Users , it's work fine in abp V6 , but we got an error on abp V 7.3.3

    Best regards

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    It looks like a problem with EF Core, not ABP.

    Will it work if you use a net core application without ABP?

  • User Avatar
    0
    aqudah81 created

    Hi liangshiwei , The sample work fine int .Net 7 with EF7 , please find this console application .

    Best regards

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I will check it

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    There is a problem between IdentityUser and IdentityUserView

    Can you explain what's the relationships?

    https://learn.microsoft.com/en-us/ef/core/modeling/relationships/one-to-one

    b.HasOne<IdentityUser>().WithOne().HasForeignKey<IdentityUserView>(e => e.Id)

  • User Avatar
    0
    aqudah81 created

    Hi , The relation is One-to-one with no navigations : protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<Blog>() .HasOne<BlogHeader>() .WithOne() .HasForeignKey<BlogHeader>(e => e.BlogId) .IsRequired(); }

    The two entities mapped to the same table. Also if we change it like this we still have the same error : b.HasOne<IdentityUser>().WithOne().HasForeignKey<IdentityUserView>(e => e.Id);

    Please can you check this project after add new Entities Country and CountryView which also mapped to one Table "AppCountries" , you will see that the project work fine (after comment the ModelBuilder configuration for users).

    Another important things the "DbMigrator" project also throw the same error when we run it (after uncomment the ModelBuilder configuration for users).

    It's seems the issue is with **IdentityUser **class .

    Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I will check Country and CountryView .

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can test this

    public class MyExtraPropertyDictionaryValueComparer : ValueComparer<ExtraPropertyDictionary>
    {
        public MyExtraPropertyDictionaryValueComparer()
            : base(
                (a, b) => Compare(a, b),
                d => d.Aggregate(0, (k, v) => HashCode.Combine(k, v.GetHashCode())),
                d => new ExtraPropertyDictionary(d))
        {
        }
    
        private static bool Compare(ExtraPropertyDictionary? a, ExtraPropertyDictionary? b)
        {
            if (a == null && b == null)
            {
                return true;
            }
    
            if (a == null && b != null || a != null && b == null)
            {
                return false;
            }
    
            return a!.SequenceEqual(b!);
        }
    }
    
    builder.Entity<IdentityUser>(b =>
    {
        b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "Users", AbpIdentityDbProperties.DbSchema);
        b.ConfigureByConvention();
    
        b.Property(x => x.LockoutEnd).HasColumnName(nameof(IdentityUser.LockoutEnd));
        b.Property(x => x.Id).HasColumnName(nameof(IdentityUser.Id));
    
        b.Property(x => x.ExtraProperties)
            .HasColumnName(nameof(IHasExtraProperties.ExtraProperties))
            .HasConversion(new ExtraPropertiesValueConverter(b.Metadata.ClrType))
            .Metadata.SetValueComparer(new MyExtraPropertyDictionaryValueComparer());
    });
    
    builder.Entity<IdentityUserView>(b =>
    {
        b.ToTable(AbpAuditLoggingDbProperties.DbTablePrefix + "Users", AbpIdentityDbProperties.DbSchema);
        b.ConfigureByConvention();
    
        b.Property(x => x.ExtraProperties)
            .HasColumnName(nameof(IHasExtraProperties.ExtraProperties))
            .HasConversion(new ExtraPropertiesValueConverter(b.Metadata.ClrType))
            .Metadata.SetValueComparer(new MyExtraPropertyDictionaryValueComparer());
    
        b.Property(x => x.Id).HasColumnName(nameof(IdentityUser.Id));
        b.Property(x => x.AccessFailedCount).HasColumnName(nameof(IdentityUser.AccessFailedCount));
        b.Property(x => x.Email).HasColumnName(nameof(IdentityUser.Email)).HasMaxLength(256);
        b.Property(x => x.EmailConfirmed).HasColumnName(nameof(IdentityUser.EmailConfirmed));
        b.Property(x => x.IsActive).HasColumnName(nameof(IdentityUser.IsActive));
        b.Property(x => x.IsExternal).HasColumnName(nameof(IdentityUser.IsExternal));
        b.Property(x => x.LockoutEnabled).HasColumnName(nameof(IdentityUser.LockoutEnabled));
        b.Property(x => x.LockoutEnd).HasColumnName(nameof(IdentityUser.LockoutEnd));
        b.Property(x => x.Name).HasColumnName(nameof(IdentityUser.Name)).HasMaxLength(64);
        b.Property(x => x.NormalizedEmail).HasColumnName(nameof(IdentityUser.NormalizedEmail)).HasMaxLength(256);
        b.Property(x => x.NormalizedUserName).HasColumnName(nameof(IdentityUser.NormalizedUserName)).HasMaxLength(256);
        b.Property(x => x.PasswordHash).HasColumnName(nameof(IdentityUser.PasswordHash)).HasMaxLength(256);
        b.Property(x => x.PhoneNumber).HasColumnName(nameof(IdentityUser.PhoneNumber)).HasMaxLength(16);
        b.Property(x => x.PhoneNumberConfirmed).HasColumnName(nameof(IdentityUser.PhoneNumberConfirmed));
        b.Property(x => x.SecurityStamp).HasColumnName(nameof(IdentityUser.SecurityStamp)).HasMaxLength(256);
        b.Property(x => x.Surname).HasColumnName(nameof(IdentityUser.Surname)).HasMaxLength(64);
        b.Property(x => x.TwoFactorEnabled).HasColumnName(nameof(IdentityUser.TwoFactorEnabled));
        b.Property(x => x.UserName).HasColumnName(nameof(IdentityUser.UserName)).HasMaxLength(256);
    
        b.HasOne<IdentityUser>().WithOne().HasForeignKey<IdentityUserView>(e => e.Id);
    
    });
    
    
  • User Avatar
    0
    aqudah81 created

    Hi , Thanks for your support , but after apply this fix the error was gone but still the **UsersView **table don't return any data Although the two entices mapped to the same table .

    Best regards

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi aqudah81

    Can you share the project again? Thanks

    liming.ma@volosoft.com

  • User Avatar
    0
    aqudah81 created

    Hi maliming , Sure thing , Please find the link for the [Project ]

    Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    EF core generates different restrictions for user and userview. This has nothing to do with abp.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 02, 2024, 12:35