I tried that out and it leads to multiple other issues. There is no ASYNC IEnumerable version of GetAll method. So that forces me to change the method signature and the signature of the MVC controller method that calls this app service method. Plus it fails in the app service method on this line:
var cmp = companyEditDto.MapTo<EditCompanyDto>();
With the error below:
Missing type map configuration or unsupported mapping.
Mapping types:
EntityQueryable`1 -> EditCompanyDto
Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1[[EXLNT.NursingOps17.NursingOps.Company, EXLNT.NursingOps17.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null]] -> EXLNT.NursingOps17.NursingOps.Dto.EditCompanyDto
However, what I dont understand is I have two other related entities address and contact on this entity and they are both getting returned with the code I shared. Note entity is the only one it keeps returning as NULL. Is this something related to EF core change?
<cite>alper: </cite> Hi,
I found the problem in your solution. You have commented out base OnModelCreating, that's why migrations cannot be done correctly.
//base.OnModelCreating(modelBuilder);
Using the empty DbContext below will solve your problem ;) .
public class RemodelOpsDbContext : AbpZeroDbContext<Tenant, Role, User, RemodelOpsDbContext> { public RemodelOpsDbContext(DbContextOptions<RemodelOpsDbContext> options) : base(options) { } }
Thanks! That worked!
I am moving my MVC5 template app to .Net Core 1.1 MVC template. So I am porting over all my working code from the prior solution to the new .Net core solution. I have converted just 2 entities so far into the new solution. The first one was simple as it had no related data. My second entity has several relationships. The relationship to "Note" entity is not working.
public async Task<EditCompanyDto> GetCompanyForEdit(NullableIdDto input)
{
var companyEditDto = (await _companyRepository.GetAsync((int)input.Id));
var cmp = companyEditDto.MapTo<EditCompanyDto>();
return cmp;
}
The code above works just fine in my existing MVC5 template solution. When I run this in the .Net core solution, it does not bring the "Note" entity data. This time my company record has a valid NoteId in the DB.
Here is my EditCompanyDto
[AutoMap(typeof(Company))]
public class EditCompanyDto : EditCompanyDtoForUpdate
{
public DateTime CreationTime { get; set; }
public int CreatorUserId { get; set; }
public string CreatedByUser { get; set; }
public DateTime LastModificationTime { get; set; }
public int LastModifierUserId { get; set; }
public string LastModifiedByUser { get; set; }
public EditNoteHeaderDto Note { get; set; }
public List<EditCompanyAddressDto> Addresses { get; set; }
public List<EditCompanyContactDto> Contacts { get; set; }
public EditCompanyDto()
{
Addresses = new List<EditCompanyAddressDto>();
Contacts = new List<EditCompanyContactDto>();
}
}
Can you please tell me if I need to do something different in .Net core to make this work?
<cite>alper: </cite> Bower requires node, npm and git.
Thanks! This tip: <a class="postlink" href="https://stackoverflow.com/a/43078816">https://stackoverflow.com/a/43078816</a>, fixed my issue! All packages are installed now.
<cite>alper: </cite> i think you shared the wrong dto. What i want to see is the input dto that lists the departments. I think CompanyId has validation attribute like RangeValidator.
The one I shared above is correct. DepartmentListDto, is what I use on the index view page. I dont have a companyId range validator anywhere. Company is displayed as dropdown on all pages.
@Support - Any updates on this issue, have you had a chance to reproduce the error or look at the solution I shared with you?
Here is the DTO for the Index view, for the department entity. This is the same one I shared in the error screenshot above.
[AutoMapFrom(typeof(Department))]
public class DepartmentListDto : EntityDto, IHasCreationTime
{
public string CompanyName { get; set; }
public int CompanyId { get; set; }
public string DeptCode { get; set; }
public string DepartmentName { get; set; }
public string Location { get; set; }
public bool ActiveYesNo { get; set; }
public DateTime CreationTime { get; set; }
public string CreatedByUser { get; set; }
}
<cite>Ribbo: </cite> You are 100% right, I did not have Git installed on the machine and Bower was throwing an error due to this trying to restore. Once Git was installed Bower loaded all required components. I am sure its the same issue for the other person above.
Thanks!
I do not use GIT for my source control. I am using TFS. Do I still need to use the same steps to resolve my issue?
<cite>alirizaadiyahsi: </cite> Hi,
which version did you download, Angular or JQuery?
JQUERY MVC template
One more question/issue.
Is there some breaking change for how the Index view app services work in v4.1? All but one of my existing app services for index views is breaking. It seems to happen, mainly, on the index views where I have filters. It keeps failing with validation error messages? <a class="postlink" href="https://drive.google.com/file/d/0B5HAoiVVXzY7Zml1aDBjTWhMcmM/view?usp=sharing">https://drive.google.com/file/d/0B5HAoi ... sp=sharing</a>
The log file shows this detail for the same error:
WARN 2017-07-04 11:59:36,331 [129 ] nHandling.AbpApiExceptionFilterAttribute - Method arguments are not valid! See ValidationErrors for details.
Abp.Runtime.Validation.AbpValidationException: Method arguments are not valid! See ValidationErrors for details.
at Abp.Runtime.Validation.Interception.MethodInvocationValidator.ThrowValidationError()
at Abp.Runtime.Validation.Interception.MethodInvocationValidator.Validate()
at Abp.WebApi.Validation.AbpApiValidationFilter.<ExecuteActionFilterAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.WebApi.Auditing.AbpApiAuditFilter.<ExecuteActionFilterAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.WebApi.Security.AntiForgery.AbpAntiForgeryApiFilter.<ExecuteAuthorizationFilterAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.WebApi.Authorization.AbpApiAuthorizeFilter.<ExecuteAuthorizationFilterAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
WARN 2017-07-04 11:59:36,331 [129 ] nHandling.AbpApiExceptionFilterAttribute - There are 1 validation errors:
WARN 2017-07-04 11:59:36,331 [129 ] nHandling.AbpApiExceptionFilterAttribute - (input.CompanyId)
The value for input.CompanyId on all my index views is NULL, this works just fine with my existing app on ABP version 1.5. Is there something that I need to do differently?