Base solution for your next web application

Activities of "liam1983"

Hi,

I read the documentation and add my BaseRepository to my DbContext

[AutoRepositoryTypes(
        typeof(IRepository<>),
        typeof(IRepository<,>),
        typeof(CointoRepositoryBase<>),
        typeof(CointoRepositoryBase<,>))]
public class CointoDbContext : AbpZeroDbContext<Tenant, Role, User, CointoDbContext>

but after that my Tests failed with

Castle.MicroKernel.ComponentActivator.ComponentActivatorException : ComponentActivator: could not proxy Cointo.EntityFrameworkCore.Repositories.CointoRepositoryBase1[[Abp.Localization.ApplicationLanguage, Abp.Zero.Common, Version=2.0.1.0, Culture=neutral, PublicKeyToken=null]] ---- Castle.DynamicProxy.InvalidProxyConstructorArgumentsException : Can not instantiate proxy of class: Cointo.EntityFrameworkCore.Repositories.CointoRepositoryBase1[[Abp.Localization.ApplicationLanguage, Abp.Zero.Common, Version=2.0.1.0, Culture=neutral, PublicKeyToken=null]]. Could not find a parameterless constructor.

what can I do? Only add a parameterless ctor doesnt help me much

Hi,

I try to make a unit test for one of my Services, the problem is my custom mapping didnt happen. What did I wrong? I would like to map special Sub entities to only a string.

[AutoMap(typeof(Coin))]
    public class CoinListDto : FullAuditedEntityDto<Guid>
    {
        [Range(0, Int32.MaxValue)]
        public int? Amount { get; set; }

        [Required(AllowEmptyStrings = false)]
        [MaxLength(500)]
        public string Name { get; set; }

        [Range(-2000, 9999)]
        public int Year { get; set; }

        [Range(0, Int32.MaxValue)]
        public int NominalValue { get; set; }

        public string Country { get; set; }

        public string Currency { get; set; }
    }

in my module

public override void PostInitialize()
        {
            base.PostInitialize();
            Configuration.Modules.AbpAutoMapper().Configurators.Add(
                mapper =>
                    {
                        mapper.CreateMap<Entities.Coin.Coin, CoinListDto>();
                        mapper.CreateMap<Entities.Coin.Coin, CoinListDto>()
                            .ForMember(dto => dto.Country, opt => opt.MapFrom(coin => coin.Country.Name));
                        mapper.CreateMap<Entities.Coin.Coin, CoinListDto>()
                            .ForMember(dto => dto.Currency, opt => opt.MapFrom(coin => coin.Currency.Name));
                    });
        }

but when I execute the test my custom mappings dont happen

Question

i had a WebApi Project but I need in the list much less data then in the detail view of an item, what's more correct:

GetAll returns a different DTO or GetAll for the list is in an own controller only with the methods needed

Hi,

I try something with the ASP.NET Core template but why its called ASP.NET Core? Its not Core and Entity Framework is also not Core what did I understand wrong here?

Showing 1 to 4 of 4 entries