Starts in:
1 DAY
7 HRS
45 MIN
26 SEC
Starts in:
1 D
7 H
45 M
26 S
Open Closed

Manually created lookup property not working #8079


User avatar
0
Navneet@aol.com.au created
  • ABP Framework version: v8.2.3
  • UI Type: MVC
  • Database System: EF Core (MySQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hello Team,

I have created a lookup property manually however, I am getting an error in accessing, below of my project details:

Domain Class:
  public abstract class LicenseTypeBase : FullAuditedAggregateRoot<Guid>
    {
        [NotNull]
        public virtual string LicenseName { get; set; }

        public virtual bool IsTrial { get; set; }

        public virtual int? TrialPeriod { get; set; }

        public virtual int ProductLicenseLimit { get; set; }

        public virtual int ProductLicenseValidationInDays { get; set; }

        public virtual int ProductViolationLimit { get; set; }

        public virtual int UserLicenseLimit { get; set; }

        public virtual int UserLicenseValidationInDays { get; set; }

        public virtual int UserViolationLimit { get; set; }

        public virtual double? LicensePrice { get; set; }

        public virtual bool IsActive { get; set; }

        [CanBeNull]
        public virtual string? Comments { get; set; }
        public Guid ProductId { get; set; }
        public Guid? LicensePeriodId { get; set; }

        protected LicenseTypeBase()
        {

        }

        public LicenseTypeBase(Guid id, Guid productId, Guid? licensePeriodId, string licenseName, bool isTrial, int productLicenseLimit, int productLicenseValidationInDays, int productViolationLimit, int userLicenseLimit, int userLicenseValidationInDays, int userViolationLimit, bool isActive, int? trialPeriod = null, double? licensePrice = null, string? comments = null)
        {

            Id = id;
            Check.NotNull(licenseName, nameof(licenseName));
            Check.Length(licenseName, nameof(licenseName), LicenseTypeConsts.LicenseNameMaxLength, 0);
            LicenseName = licenseName;
            IsTrial = isTrial;
            ProductLicenseLimit = productLicenseLimit;
            ProductLicenseValidationInDays = productLicenseValidationInDays;
            ProductViolationLimit = productViolationLimit;
            UserLicenseLimit = userLicenseLimit;
            UserLicenseValidationInDays = userLicenseValidationInDays;
            UserViolationLimit = userViolationLimit;
            IsActive = isActive;
            TrialPeriod = trialPeriod;
            LicensePrice = licensePrice;
            Comments = comments;
            ProductId = productId;
            LicensePeriodId = licensePeriodId;
        }

    }
 
 public abstract class LicenseTypeLookupDto : EntityDto<Guid>
    {
        [NotNull]
        public string LicenseName { get; set; }

    }

Auto Mapper:
CreateMap<LicenseType, LicenseTypeLookupDto>();

Interface:

 public partial interface ILicenseSubscriptionsAppService
    {
        //Write your custom code here...

         Task<ListResultDto<LicenseTypeLookupDto>> GetLicenseTypeLookupAsync();
    }

 public class LicenseSubscriptionsAppService : LicenseSubscriptionsAppServiceBase, ILicenseSubscriptionsAppService
    {
        //Write your custom code...
        private readonly IRepository<LicenseType, Guid> _licenseTypeRepository;
        public LicenseSubscriptionsAppService(ILicenseSubscriptionRepository licenseSubscriptionRepository, LicenseSubscriptionManager licenseSubscriptionManager, IRepository<LicenseType, Guid> licenseTypeRepository)
            : base(licenseSubscriptionRepository, licenseSubscriptionManager)
        {
            _licenseTypeRepository = licenseTypeRepository;
        }
        public async Task<ListResultDto<LicenseTypeLookupDto>> GetLicenseTypeLookupAsync()
        {
            var licensetype = await _licenseTypeRepository.GetListAsync();

             return new ListResultDto<LicenseTypeLookupDto>(
                return ObjectMapper.Map<List<LicenseType>, List<LicenseTypeLookupDto>>(licensetype)
             );
        }
    }

Can you please suggest what am I doing wrong

many thx, Navneet


3 Answer(s)
  • User Avatar
    0
    Navneet@aol.com.au created

    Below is my Error Details:

    [14:43:59 DBG] Executing HealthCheck collector HostedService.
    [14:43:59 INF] Start processing HTTP request GET https://localhost:44334/health-status
    [14:43:59 INF] Sending HTTP request GET https://localhost:44334/health-status
    [14:43:59 INF] Request starting HTTP/1.1 GET https://localhost:44334/health-status - null null
    [14:43:59 DBG] Added 0 entity changes to the current audit log
    [14:43:59 DBG] Added 0 entity changes to the current audit log
    [14:43:59 DBG] Added 0 entity changes to the current audit log
    [14:43:59 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri.
    [14:43:59 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri.
    [14:43:59 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType.
    [14:43:59 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType.
    [14:43:59 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader.
    [14:43:59 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ValidateHostHeader.
    [14:43:59 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+EvaluateValidatedTokens.
    [14:43:59 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromAuthorizationHeader.
    [14:43:59 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromBodyForm.
    [14:43:59 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromQueryString.
    [14:43:59 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens.
    [14:43:59 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was marked as rejected by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens.
    [14:43:59 DBG] AuthenticationScheme: OpenIddict.Validation.AspNetCore was not authenticated.
    [14:43:59 INF] Executing endpoint 'Health checks'
    [14:43:59 DBG] Added 0 entity changes to the current audit log
    [14:43:59 INF] Executed endpoint 'Health checks'
    [14:43:59 INF] Received HTTP response headers after 495.9926ms - 200
    [14:43:59 INF] End processing HTTP request after 496.1858ms - 200
    [14:43:59 INF] Request finished HTTP/1.1 GET https://localhost:44334/health-status - 200 null application/json 493.3882ms
    [14:43:59 DBG] HealthReportCollector - health report execution history saved.
    [14:43:59 DBG] HealthReport history already exists and is in the same state, updating the values.
    [14:43:59 DBG] HealthReportCollector has completed.
    [14:43:59 DBG] HealthCheck collector HostedService executed successfully.
    [14:43:59 INF] Request starting HTTP/2 GET https://localhost:44334/abp/Swashbuckle/SetCsrfCookie - null null
    [14:43:59 DBG] Added 0 entity changes to the current audit log
    [14:43:59 DBG] Added 0 entity changes to the current audit log
    [14:43:59 DBG] Added 0 entity changes to the current audit log
    [14:43:59 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri.
    [14:43:59 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri.
    [14:43:59 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType.
    [14:43:59 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType.
    [14:43:59 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader.
    [14:43:59 DBG] Get dynamic claims cache for user: 3a14defd-ddaf-0b84-fd19-326c5165c553
    [14:43:59 DBG] SessionId(fafe2cb1-86ab-44cf-b334-a73b08878be7) found in cache, Updating hit count(1), last access time(10/12/2024 2:42:28 PM) and IP address(::1).
    [14:43:59 INF] Executing endpoint 'Volo.Abp.Swashbuckle.AbpSwashbuckleController.SetCsrfCookie (Volo.Abp.Swashbuckle)'
    [14:43:59 INF] Route matched with {area = "Abp", action = "SetCsrfCookie", controller = "AbpSwashbuckle", page = ""}. Executing controller action with signature Void SetCsrfCookie() on controller Volo.Abp.Swashbuckle.AbpSwashbuckleController (Volo.Abp.Swashbuckle).
    [14:43:59 INF] Executed action Volo.Abp.Swashbuckle.AbpSwashbuckleController.SetCsrfCookie (Volo.Abp.Swashbuckle) in 1.7135ms
    [14:43:59 INF] Executed endpoint 'Volo.Abp.Swashbuckle.AbpSwashbuckleController.SetCsrfCookie (Volo.Abp.Swashbuckle)'
    [14:43:59 INF] Request finished HTTP/2 GET https://localhost:44334/abp/Swashbuckle/SetCsrfCookie - 204 null null 252.0513ms
    [14:44:00 INF] Request starting HTTP/2 GET https://localhost:44334/api/base-license/license-subscriptions/GetLicenseTypeLookup - null null
    [14:44:00 DBG] Added 0 entity changes to the current audit log
    [14:44:00 DBG] Added 0 entity changes to the current audit log
    [14:44:00 DBG] Added 0 entity changes to the current audit log
    [14:44:00 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri.
    [14:44:00 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri.
    [14:44:00 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType.
    [14:44:00 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType.
    [14:44:00 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader.
    [14:44:00 DBG] Get dynamic claims cache for user: 3a14defd-ddaf-0b84-fd19-326c5165c553
    [14:44:00 DBG] SessionId(fafe2cb1-86ab-44cf-b334-a73b08878be7) found in cache, Updating hit count(2), last access time(10/12/2024 2:43:59 PM) and IP address(::1).
    [14:44:00 INF] Executing endpoint 'TechDB.BaseLicense.LicenseSubscriptions.LicenseSubscriptionController.GetLicenseTypeLookupAsync (TechDB.BaseLicense.HttpApi)'
    [14:44:00 INF] Route matched with {area = "baseLicense", controller = "LicenseSubscription", action = "GetLicenseTypeLookup", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.Application.Dtos.ListResultDto`1[TechDB.BaseLicense.LicenseSubscriptions.LicenseTypeLookupDto]] GetLicenseTypeLookupAsync() on controller TechDB.BaseLicense.LicenseSubscriptions.LicenseSubscriptionController (TechDB.BaseLicense.HttpApi).
    [14:44:00 DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:3a14defd-ddaf-0b84-fd19-326c5165c553,n:BaseLicense.LicenseSubscriptions
    [14:44:00 DBG] Found in the cache: pn:U,pk:3a14defd-ddaf-0b84-fd19-326c5165c553,n:BaseLicense.LicenseSubscriptions
    [14:44:00 DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:BaseLicense.LicenseSubscriptions
    [14:44:00 DBG] Found in the cache: pn:R,pk:admin,n:BaseLicense.LicenseSubscriptions
    Exception thrown: 'System.InvalidCastException' in TechDB.BaseLicense.Application.dll
    [14:44:04 ERR] ---------- RemoteServiceErrorInfo ----------
    {
      "code": null,
      "message": "An internal error occurred during your request!",
      "details": null,
      "data": {},
      "validationErrors": null
    }
    
    [14:44:04 ERR] Unable to cast object of type 'SelectListIterator`2[TechDB.BaseLicense.LicenseTypes.LicenseType,&lt;&gt;f__AnonymousType0`2[System.String,System.Guid]]' to type 'System.Collections.Generic.List`1[TechDB.BaseLicense.LicenseTypes.LicenseType]'.
    System.InvalidCastException: Unable to cast object of type 'SelectListIterator`2[TechDB.BaseLicense.LicenseTypes.LicenseType,<>f__AnonymousType0`2[System.String,System.Guid]]' to type 'System.Collections.Generic.List`1[TechDB.BaseLicense.LicenseTypes.LicenseType]'.
       at TechDB.BaseLicense.LicenseSubscriptions.LicenseSubscriptionsAppService.GetLicenseTypeLookupAsync() in /Users/navneet/Documents/myprojects/TechDB/TechDB.Licensing1/TechDB.Licensing/modules/TechDB.BaseLicense/src/TechDB.BaseLicense.Application/LicenseSubscriptions/LicenseSubscriptionsAppService.Extended.cs:line 44
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope)
       at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at lambda_method6410(Closure, Object)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeActionMethodAsync&gt;g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
    [14:44:04 INF] Executing ObjectResult, writing value of type 'Volo.Abp.Http.RemoteServiceErrorResponse'.
    [14:44:04 INF] Executed action TechDB.BaseLicense.LicenseSubscriptions.LicenseSubscriptionController.GetLicenseTypeLookupAsync (TechDB.BaseLicense.HttpApi) in 4392.2582ms
    [14:44:04 INF] Executed endpoint 'TechDB.BaseLicense.LicenseSubscriptions.LicenseSubscriptionController.GetLicenseTypeLookupAsync (TechDB.BaseLicense.HttpApi)'
    [14:44:04 DBG] Added 0 entity changes to the current audit log
    [14:44:04 DBG] Added 0 entity changes to the current audit log
    [14:44:04 INF] Request finished HTTP/2 GET https://localhost:44334/api/base-license/license-subscriptions/GetLicenseTypeLookup - 500 null application/json; charset=utf-8 4728.0972ms
    
    
  • User Avatar
    0
    Navneet@aol.com.au created

    Sorry, found the issue, there was a typing mistake.

    Could you please refund this ticket?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    okay

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06