Open Closed

Navigating into User Entity from Another Entity #657


User avatar
0
falsharif created

Hi team,
Iam Trying to create a navigation property for Appuser from my entity so i can include the name of the creator in the front end :
i read the documentation and it said something about maping it or ignoring it , but i dont understand what to do exactly

My entity :

{
public class InventoryAdjustmentLog : AuditedEntityWithUser<Guid,AppUser>
{

    public InventoryAdjustmentLog()
    {
        
      
    }

  
   public int CurrentStockLevel { get; set; }

   public int AdjustedStockLevel { get; set; }

   public Guid? ReasonId { get; set; }

   public virtual Reason Reason { get; set; }

    public Guid ProductId { get; set; }

   public virtual Product Product { get; set; }


 

}

}

How can i implement this without getting this error :

---- System.InvalidOperationException : The property 'AppUser.ExtraProperties' could not be mapped, because it is of type 'Dictionary<string, object>' which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.

Message:
Volo.Abp.AbpInitializationException : An error occurred during ConfigureServices phase of the module Dukkantek.EntityFrameworkCore.DukkantekEntityFrameworkCoreTestModule, Dukkantek.EntityFrameworkCore.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details.
---- System.InvalidOperationException : The property 'AppUser.ExtraProperties' could not be mapped, because it is of type 'Dictionary<string, object>' which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
Stack Trace:
AbpApplicationBase.ConfigureServices()
AbpApplicationBase.ctor(Type startupModuleType, IServiceCollection services, Action1 optionsAction) AbpApplicationWithExternalServiceProvider.ctor(Type startupModuleType, IServiceCollection services, Action1 optionsAction)
AbpApplicationFactory.Create(Type startupModuleType, IServiceCollection services, Action1 optionsAction) AbpApplicationFactory.Create[TStartupModule](IServiceCollection services, Action1 optionsAction)
ServiceCollectionApplicationExtensions.AddApplication[TStartupModule](IServiceCollection services, Action1 optionsAction) AbpIntegratedTest1.ctor()
DukkantekTestBase1.ctor() DukkantekApplicationTestBase.ctor() InventoryAppServiceTests.ctor(ITestOutputHelper Output) line 23 ----- Inner Stack Trace ----- ModelValidator.ValidatePropertyMapping(IModel model, IDiagnosticsLogger1 logger)
ModelValidator.Validate(IModel model, IDiagnosticsLogger1 logger) RelationalModelValidator.Validate(IModel model, IDiagnosticsLogger1 logger)
SqliteModelValidator.Validate(IModel model, IDiagnosticsLogger1 logger) ValidatingConvention.ProcessModelFinalized(IConventionModelBuilder modelBuilder, IConventionContext1 context)
ImmediateConventionScope.OnModelFinalized(IConventionModelBuilder modelBuilder)
ConventionDispatcher.OnModelFinalized(IConventionModelBuilder modelBuilder)
Model.FinalizeModel()
ModelBuilder.FinalizeModel()
ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder)
ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder)
DbContextServices.CreateModel()
DbContextServices.get_Model()
<>c.<TryAddCoreServices>b__7_3(IServiceProvider p)
CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType) CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context) CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType) CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context) CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
ServiceProviderEngineScope.GetService(Type serviceType)
ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
DbContext.get_DbContextDependencies()
DbContext.get_InternalServiceProvider()
IServiceProvider>.get_Instance()
InfrastructureExtensions.GetService[TService](IInfrastructure1 accessor) AccessorExtensions.GetService[TService](IInfrastructure1 accessor)
DukkantekEntityFrameworkCoreTestModule.CreateDatabaseAndGetConnection() line 56
DukkantekEntityFrameworkCoreTestModule.ConfigureInMemorySqlite(IServiceCollection services) line 29
DukkantekEntityFrameworkCoreTestModule.ConfigureServices(ServiceConfigurationContext context) line 25
AbpApplicationBase.ConfigureServices()

  • ABP Framework version: v3.1.2

  • UI type: Angular

  • Tiered (MVC) or Identity Server Seperated (Angular): no

  • Exception message and stack trace:

  • Steps to reproduce the issue:


3 Answer(s)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on June 13, 2025, 11:37