Power Tools version 2.4.0.1 was used to create the following entity and code.
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Abp.Domain.Entities.Auditing;
using Abp.Domain.Entities;
namespace ngTTM.TtmDataModel
{
[Table("TtmExamStates")]
public class ExamState : Entity
{
[Required]
public virtual string Guid { get; set; }
public virtual int ItemsProcesssed { get; set; }
public virtual int ItemsTotal { get; set; }
public virtual double MathNotationRenderDuration { get; set; }
}
}
public async Task<PagedResultDto<GetExamStateForViewDto>> GetAll(GetAllExamStatesInput input)
{
var filteredExamStates = _examStateRepository.GetAll()
.WhereIf(!string.IsNullOrWhiteSpace(input.Filter), e => false || e.Guid.Contains(input.Filter))
.WhereIf(!string.IsNullOrWhiteSpace(input.GuidFilter), e => e.Guid == input.GuidFilter);
var pagedAndFilteredExamStates = filteredExamStates
.OrderBy(input.Sorting ?? "id asc")
.PageBy(input);
var examStates = from o in pagedAndFilteredExamStates
select new GetExamStateForViewDto() {
ExamState = new ExamStateDto
{
Guid = o.Guid,
ItemsProcesssed = o.ItemsProcesssed,
ItemsTotal = o.ItemsTotal,
MathNotationRenderDuration = o.MathNotationRenderDuration,
Id = o.Id
}
};
var totalCount = await filteredExamStates.CountAsync();
return new PagedResultDto<GetExamStateForViewDto>(
totalCount,
await examStates.ToListAsync()
);
}
Clicking the columns for the integer values will sort ascending and descending as expected. Clicking the column for the string value (Guid) causes an Exception on the server. Logs.txt:
ERROR 2020-06-29 22:00:06,436 [44 ] Mvc.ExceptionHandling.AbpExceptionFilter - '.' or '(' or string literal expected
'.' or '(' or string literal expected (at index 5)
INFO 2020-06-29 22:00:06,437 [44 ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'.
INFO 2020-06-29 22:00:06,438 [44 ] c.Infrastructure.ControllerActionInvoker - Executed action ngTTM.TtmDataModel.ExamStatesAppService.GetAll (ngTTM.Application) in 102.9678ms
INFO 2020-06-29 22:00:06,438 [44 ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'ngTTM.TtmDataModel.ExamStatesAppService.GetAll (ngTTM.Application)'
INFO 2020-06-29 22:00:06,438 [44 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished in 120.4762ms 500 application/json; charset=utf-8
DEBUG 2020-06-29 22:00:08,053 [37 ] HttpRequestEntityChangeSetReasonProvider - Unable to get URL from HttpRequest, fallback to null
The fault occurs on this statement:
var pagedAndFilteredExamStates = filteredExamStates
.OrderBy(input.Sorting ?? "id asc")
.PageBy(input);
- Why is generated code not functioning without faults?
- What changes need to be made to fix this?
6 Answer(s)
-
0
Hi @timmackey I could not reproduce it in last version of zero.
What is your abp version? What is your zero version?
-
0
Last upgrade: ANZ 8.0.0
Server: Web.Public\package.json(9): "abp-web-resources": "^3.3.0"
Client: package.json: "abp-ng2-module": "^5.0.0", "abp-web-resources": "^4.1.0",
-
0
I could not reproduce it. Can you please share recurring project to [email protected]
-
0
I'll try an upgrade to ANZ 9.0 and see if that solves the problem. I'll get back to you in a couple of weeks.
-
0
Hi @timmackey
We have upgraded to Metronic 7.0 with AspNet Zero v9.0 and there are many breaking changes in the UI. I just wanted to inform you about this, so maybe you don't want to upgrade and just fix this problem.
-
0
Problem discovered: dbo.TtmExamStates column 'Guid' was migrated from another table and renamed 'ExamGuid' after Entity Generator regenerated client code.
Resolution: Fixed code on client to correct name.
Power Tools Entity Generator appears to be working as designed.