Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "direccionti"

Hi @ismcagdas I could test on base aspnetzero 11.0.0.0 and it works correctly. I'll check my code merged. When I know about the problem I'll tell you.Thanks!

Hi, I found the problem. I don't know when service.config.nswag file changed, but i restored the file. Thanks.

Hi!

Thanks!

Hi! Solved! the backend should have the subdomain specified too.

Thanks.

I got it!

In the dbContext, in "OnModelCreatring" method i added:

modelBuilder.Entity<OrganizationUnit>(b =>
            {
                b.Property<string>("Discriminator")
                    .IsRequired();
                b.ToTable("AbpOrganizationUnits");
                b.HasDiscriminator<string>("Discriminator").HasValue("OrganizationUnit");
            });

            modelBuilder.Entity<OrganizationUnitExtended>(b =>
            {
                b.HasBaseType("Abp.Organizations.OrganizationUnit");
                b.Property<int>("MunicipioId");
                b.Property<int>("TipoUnidadOrganizacionalId");
                b.HasIndex("MunicipioId");
                b.HasIndex("TipoUnidadOrganizacionalId");
                b.ToTable("AbpOrganizationUnits");
                b.HasDiscriminator().HasValue("OrganizationUnitExtended");
            });

Hello! I have a problem when get all organization units.

My Custom class:

public class OrganizationUnitExtended: OrganizationUnit
    {
        public virtual int TipoUnidadOrganizacionalId { get; set; }

        [ForeignKey("TipoUnidadOrganizacionalId")]
        public virtual TipoUnidadOrganizacional TipoUnidadOrganizacionalFk { get; set; }

        public virtual int MunicipioId { get; set; }

        [ForeignKey("MunicipioId")]
        public virtual Municipio MunicipioFk { get; set; }
    }

Dto: the two fields are in the necessary dto.

public class OrganizationUnitDto : AuditedEntityDto<long>
    {
        public long? ParentId { get; set; }

        public string Code { get; set; }

        public string DisplayName { get; set; }

        public int MemberCount { get; set; }
        
        public int RoleCount { get; set; }

        public int TipoUnidadOrganizacionalId { get; set; }

        public int MunicipioId { get; set; }
    }

DbContext:

public virtual DbSet<OrganizationUnitExtended> OrganizationUnitsExtended { get; set; }

Mapper:

//OrganizationUnit
            configuration.CreateMap<OrganizationUnit, OrganizationUnitDto>();
            configuration.CreateMap<OrganizationUnitExtended, OrganizationUnitDto>().ReverseMap();

Service:

Defintion:

private readonly IRepository<OrganizationUnitExtended, long> _lookup_organizationUnitExtendedRepository;

public CommonLookupAppService(
...
IRepository<OrganizationUnitExtended, long> lookup_organizationUnitExtendedRepository,
...
){
_lookup_organizationUnitExtendedRepository = lookup_organizationUnitExtendedRepository;
....
}

Method: I want to get all organization units for the new field (TipoUnidadOrganizacional)

public async Task<PagedResultDto<OrganizationUnitLookupTableDto>> GetAllOrganizationUnitForLookupTable(GetAllForLookupTableInput input)
        {
            long currentUserId = Convert.ToInt64(AbpSession.UserId);

            var query = (from uou in _userOrganizationUnitRepository.GetAll()
                         join ou in _lookup_organizationUnitExtendedRepository.GetAll() on uou.OrganizationUnitId equals ou.Id
                         where uou.UserId == currentUserId && ou.TipoUnidadOrganizacionalId == (int)eTiposUnidadesOrganizacionales.Vitrina
                         select ou);

            var totalCount = await query.CountAsync();

            var organizationUnitList = await query
                .PageBy(input)
                .ToListAsync();

            var lookupTableDtoList = new List<OrganizationUnitLookupTableDto>();
            foreach (var organizationUnit in organizationUnitList)
            {
                lookupTableDtoList.Add(new OrganizationUnitLookupTableDto
                {
                    Id = organizationUnit.Id,
                    DisplayName = organizationUnit.DisplayName?.ToString()
                });
            }

            return new PagedResultDto<OrganizationUnitLookupTableDto>(
                totalCount,
                lookupTableDtoList
            );
        }

My error:

"Invalid column name 'Discriminator'.\r\nInvalid column name 'Discriminator'."

I need help! thanks!

Showing 1 to 6 of 6 entries