Base solution for your next web application

Activities of "ashjackson"

ASPZ Version - 13.1, aspnetcore + angular. DB - Entity Framework + MySQL

Hi There, I've added an additional method to the .extended class of an entity app service generated with Power Tools, and created an associated unit test. The unit test however fails with a registration error:

Abp.AbpException: Can not register IXxxxxxxxAppServiceExtended. It should be a non-abstract class. If not, it should be registered before.

Abp.AbpException
Can not register IXxxxxxxxAppServiceExtended. It should be a non-abstract class. If not, it should be registered before.
   at Abp.TestBase.AbpIntegratedTestBase`1.EnsureClassRegistered(Type type, DependencyLifeStyle lifeStyle)

The interface for the extended app service looks like this:

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Abp.Application.Services;
using Abp.Application.Services.Dto;
using Xxxxxxxx.Xxxxxxxx.Dtos;
using Xxxxxxxx.Dto;

namespace Xxxxxxxx.Xxxxxxxx
{
    public interface IXxxxxxxxAppServiceExtended
    {
        // Write your custom code here. 
        // ASP.NET Zero Power Tools will not overwrite this class when you regenerate the related entity.
        
        Task<List<Tuple<String,String>>> GetValidationMessagesAsync(Guid id);
    }
}

And the implementation:

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Abp.Domain.Repositories;
using Xxxxxxx.Xxxxxx.Exporting;
using Xxxxxx.Authorization;
using Abp.Authorization;
using Xxxxxx.Storage;

namespace Xxxxxx.Xxxxxxx
{
    [AbpAuthorize(AppPermissions.Pages_Xxxxxx)]
    public class XxxxxxxAppService : XxxxxxxAppServiceBase,
        IXxxxxxAppService,
        IXxxxxxAppServiceExtended
    {
        public XxxxxxxAppService(IRepository<Xxxxxxx, Guid> xxxxxxxRepository,
            IXxxxxxExcelExporter xxxxxxxExcelExporter,
            IRepository<Xxxxxxx,Guid> lookup_xxxxxxxRepository)
        : base(xxxxxxxRepository, xxxxxxxExcelExporter, lookup_xxxxxxxRepository
        )
        {
        }

        // Write your custom code here. 
        // ASP.NET Zero Power Tools will not overwrite this class when you regenerate the related entity.

        public async Task<List<Tuple<String, String>>> GetValidationMessagesAsync(Guid id)
        {
          // Implementation
        }

    }
}

Test:

using System;
using System.Linq;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Xxxxxx.Xxxxxxx;
using Shouldly;
using Xunit;

namespace MSystem.Tests.App.Shipping.Shiptheory;

[TestSubject(typeof(XxxxxxxAppService))]
public class XxxxxxxAppServiceTest : AppTestBase
{
    private readonly IXxxxxxxAppServiceExtended _xxxxxxxAppServiceExtended;
    private readonly Guid _testId;

    public XxxxxxxAppServiceTest()
    {
        _testId = Guid.NewGuid();
        _xxxxxxxAppServiceExtended = Resolve<IXxxxxxxAppServiceExtended>();
        SeedTestData();
    }

    private void SeedTestData()
    {
      // Seeding test data
    }
    
    [Fact]
    public async Task Should_Get_No_Validation_Messages()
    {
        // Test
    }
}

I was expecting the IXxxxxxxAppServiceExtended service to auto-register like the base service does, but for some reason that hasn't happened.

Thanks, AJ.

Question

Hi There,

Is it possible to use the power tools in a module? If so can you please advise the proper approach / steps.

Kind Regards, AJ.

Hi There,

I've noted a couple of minor issues in powertools V4.0.2, ASPZ V13.0, Visual Studio 2022 17.8.3

  1. When generating an overridable entity with a key type of Guid, the template does not include a using statement for System in the .extended file, causing a reference error on the type Guid.
  2. The Should_Update_EntityName tests generated for string values do not respect the length of short fields. If the field length is less than 18 ("Updated test value"), then the tests will failed with a validation error.
  3. The Should_Delete_EntityName tests fail due to soft delete. The test is using the context directly to fetch the updated entity, so without the soft delete logic of the aspz repository classes the default test that the deleted entity is null will fail.

I will attempt to edit my powertools templates locally to work around for now, but if these can be addressed in a future update it would be much appreciated.

Kind Regards, AJ.

Hi, Thankyou, this resolved my issue.

AJ.

Prerequisites

  • What is your product version? 10.3
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? net50

Hi There, I have recently started getting the following issue when generating service proxies

    Error: src/shared/service-proxies/service-proxies.ts:10:10 - error TS2300: Duplicate identifier 'DateTime'.

    10 import { DateTime } from 'luxon';
                ~~~~~~~~
    src/shared/service-proxies/service-proxies.ts:16:10 - error TS2300: Duplicate identifier 'DateTime'.

    16 import { DateTime, Duration } from "luxon";
                ~~~~~~~~

When I examine the imports of the service proxies file I find that there are 2 luxon imports, with DateTime in both.

/* tslint:disable */
/* eslint-disable */
//----------------------
// <auto-generated>
//     Generated using the NSwag toolchain v13.13.2.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org)
// </auto-generated>
//----------------------
// ReSharper disable InconsistentNaming

import { DateTime } from 'luxon';
import { mergeMap as _observableMergeMap, catchError as _observableCatch } from 'rxjs/operators';
import { Observable, throwError as _observableThrow, of as _observableOf } from 'rxjs';
import { Injectable, Inject, Optional, InjectionToken } from '@angular/core';
import { HttpClient, HttpHeaders, HttpResponse, HttpResponseBase } from '@angular/common/http';

import { DateTime, Duration } from "luxon";

When I manaully correct this, all is well, but if you could please shed any light on why this is happening I'd appreciate it!

Kind Regards, AJ.

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? 10.3
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? net50

Hi There, I have enabled Identity Server to enable integration of a legacy application with my ASPZ project. Each tenant in the ASPZ app will have their own instance of the legacy app. Is it possible to set the tenantid on the redirect coming from the legacy app or will the user does not have to enter it again?

What I would like to achive ideally, is that users can re-direct to the legacy app (an ASP.NET MVC app on .net framework 4.6.2) without having to log in again. If this is possible then I would be very interested in how this can be achived, but it in the case that they must log in again (which is where I've got to so far) I would like to have to tenant pre-selected in the login page.

Thanks, AJ.

Answer

Thankyou, this will be very useful.

Answer

Hi There, A further question to this point, how do the values from appconfig.json get assigned to their partners in AppConsts.ts? If I wanted to add my a new value to AppConsts which is defined in appcondig.json, can I simple add to both files, or is there another class which reads in and assigned the values?

Kind Regards, AJ.

I've tried this approach too, but had the same issue too, I had assumed I'd not understood correctly the process and parked this for later investigation, so I would be interested to see the "correct" way to upload images in this way is.

AJ.

Hi There,

My post above is taken from the log.txt in verbose level. However, I have since re-deployed into a fresh net50 preview webapp and it has worked with the framework-dependant option set in the publish wizard.

I am starting to think this is not a problem in ASPZ, but a issue with the preview version of net50 in azure, so if you cannot duplicate the issue we should close this ticket for now I think.

Kind Regards, AJ.

Showing 1 to 10 of 22 entries