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.
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
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 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.
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
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.
Hi There,
I am trying to deploy V10.1 to an azure app service. I have select .net50 (Early Access) and deployed the app using the publish wizard. I have tried both self contained and framework dependant publishing options and the same error occurs on both.
I get the following error message in the application log
<div class="content-container"><h3>HTTP Error 500.0 - Internal Server Error</h3><h4>The page cannot be displayed because an internal server error has occurred.</h4></div><div class="content-container"><fieldset><h4>Most likely causes:</h4><ul> <li>IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.</li> <li>IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.</li> <li>IIS was not able to process configuration for the Web site or application.</li> <li>The authenticated user does not have permission to use this DLL.</li> <li>The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.</li> </ul></fieldset></div><div class="content-container"><fieldset><h4>Things you can try:</h4><ul> <li>Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.</li> <li>Check the event logs to see if any additional information was logged.</li> <li>Verify the permissions for the DLL.</li> <li>Install the .NET Extensibility feature if the request is mapped to a managed handler.</li> <li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul></fieldset></div>
The web.config file generated by the deployment is as follows
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\MSystem.Web.Host.exe" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 9fc37c62-2105-4d32-9724-7323b959504b-->
Kind Regards, AJ.
Hi There,
I have some AppConsts set in the API project for various fieldlengths - are these exposed anywhere in the angular project to save duplication when validating input?
Kind Regards, AJ.
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
Hi, I have installed the the first time the power tools and created new entity (fully auditied of Guid) and associated module, rebuilt the host project, run nswag update as outlined in the documentation Angular has recompiled but now gives the following exception
core.js:4081 ERROR Error: Uncaught (in promise): Error: Component 'CompaniesComponent' is not resolved: templateUrl: ./companies.component.html
Did you run and wait for 'resolveComponentResources()'?
Error: Component 'CompaniesComponent' is not resolved: templateUrl: ./companies.component.html
Did you run and wait for 'resolveComponentResources()'?
at Function.get (core.js:25940)
at getComponentDef (core.js:1833)
at verifyDeclarationsHaveDefinitions (core.js:25637)
at Array.forEach (``)
at verifySemanticsOfNgModuleDef (core.js:25609)
at Function.get (core.js:25567)
at getInjectorDef (core.js:395)
at R3Injector.processInjectorType (core.js:11114)
at core.js:10986
at core.js:1136
at resolvePromise (zone.js:832)
at resolvePromise (zone.js:784)
at zone.js:894
at ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:27126)
at ZoneDelegate.invokeTask (zone.js:420)
at Zone.runTask (zone.js:188)
at drainMicroTaskQueue (zone.js:601)
As this appeared to be an angular error I dug around and found that the resolution to this issue was to add an explicit module id to the component declaration like this
<span class="colour" style="color: rgb(212, 212, 212);">@</span><span class="colour" style="color: rgb(78, 201, 176);">Component</span><span class="colour" style="color: rgb(212, 212, 212);">({</span> <span class="colour" style="color: rgb(156, 220, 254);">templateUrl</span><span class="colour" style="color: rgb(156, 220, 254);">:</span><span class="colour" style="color: rgb(212, 212, 212);"> </span><span class="colour" style="color: rgb(206, 145, 120);">'./companies.component.html'</span><span class="colour" style="color: rgb(212, 212, 212);">,</span> <span class="colour" style="color: rgb(156, 220, 254);">encapsulation</span><span class="colour" style="color: rgb(156, 220, 254);">:</span><span class="colour" style="color: rgb(212, 212, 212);"> </span><span class="colour" style="color: rgb(78, 201, 176);">ViewEncapsulation</span><span class="colour" style="color: rgb(212, 212, 212);">.</span><span class="colour" style="color: rgb(79, 193, 255);">None</span><span class="colour" style="color: rgb(212, 212, 212);">,</span> <span class="colour" style="color: rgb(156, 220, 254);">animations</span><span class="colour" style="color: rgb(156, 220, 254);">:</span><span class="colour" style="color: rgb(212, 212, 212);"> [</span><span class="colour" style="color: rgb(220, 220, 170);">appModuleAnimation</span><span class="colour" style="color: rgb(212, 212, 212);">()],</span> <span class="colour" style="color: rgb(156, 220, 254);">moduleId</span><span class="colour" style="color: rgb(156, 220, 254);">:</span><span class="colour" style="color: rgb(212, 212, 212);"> </span><span class="colour" style="color: rgb(156, 220, 254);">module</span><span class="colour" style="color: rgb(212, 212, 212);">.</span><span class="colour" style="color: rgb(156, 220, 254);">id</span> <span class="colour" style="color: rgb(212, 212, 212);">})</span> <span class="colour" style="color: rgb(212, 212, 212);"></span> Is this a bug in the power tools, or have I done something wrong? Please advise if I should update the template (and how) or if I need to do something else to enable use of the power tools correctly.
Kind Regards, AJ.
Hi There,
I have successfully created my own custom modules (core, shared, application etc) to hold my own code, so that all code I write is kept in separate modules and separate .net projects from the supplied Zero code - However, the 1 area I can't seem to work out from the documentation is can I add a second DBContext for my entities so this too can be kept separate from the supplied code in it's own module?
I will use the same connection string, but in my context will specify a schema name so SQL Server will treat my context as a separate DB in the same file.
Thankyou in advance for your guidance.
AJ.