<cite>ismcagdas: </cite> Hi @exlnt,
Can you share your project with us via <a href="mailto:[email protected]">[email protected]</a> ? In that way, we will solve your problem faster.
Thanks.
I actually am trying to convert my solution into the .NET Core MVC/JQuery (V4.1) template. I am facing some issue with that template too. If I am unable to get the .NET Core solution working, I will share my existing solution for this issue. Thanks!
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