Base solution for your next web application
Open Closed

Delete error #2858


User avatar
0
inovatech created

I'm creating an OrganizationUnit-dependent table, with contact information (Name, Phone, etc.). However I am having an error in the command to delete a contact and I am not understanding the reason. Could you help me, please?

The error message is (obtained by the Audit log): <span style="color:#FF0000"> System.Reflection.AmbiguousMatchException: EquivalĂȘncia ambĂ­gua encontrada. em System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) em System.Type.GetProperty(String name, BindingFlags bindingAttr) em System.Linq.Expressions.Expression.PropertyOrField(Expression expression, String propertyOrFieldName) em Abp.Domain.Repositories.AbpRepositoryBase2.CreateEqualityExpressionForId(TPrimaryKey id) na D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Repositories\AbpRepositoryBase.cs:linha 262 em Abp.Domain.Repositories.AbpRepositoryBase2.FirstOrDefault(TPrimaryKey id) na D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Repositories\AbpRepositoryBase.cs:linha 104 em Castle.Proxies.EfRepositoryBase3Proxy_22.FirstOrDefault_callback(Int64 id) em Castle.Proxies.Invocations.AbpRepositoryBase2_FirstOrDefault_52.InvokeMethodOnTarget() em Castle.DynamicProxy.AbstractInvocation.Proceed() em Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) na D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:linha 53 em Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) na D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:linha 45 em Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) na D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:linha 35 em Castle.DynamicProxy.AbstractInvocation.Proceed() em Castle.Proxies.EfRepositoryBase3Proxy_22.FirstOrDefault(Int64 id) em Abp.EntityFramework.Repositories.EfRepositoryBase3.Delete(TPrimaryKey id) na D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Repositories\EfRepositoryBaseOfTEntityAndTPrimaryKey.cs:linha 174 em Castle.Proxies.EfRepositoryBase`3Proxy_22.Delete_call...

The call of the Angular command is: vm.deleteContato = function (contato) { abp.message.confirm( app.localize('ContatoDeleteWarningMessage', contato.nome), function (isConfirmed) { if (isConfirmed) { organizationUnitService.deleteContato({ id: contato.depositoContatoId }).then(function () { vm.getOrganizationUnits(); abp.notify.success(app.localize('SuccessfullyDeleted')); }); } } ); };

In the ApplicationService I'm doing this:

public async Task DeleteContato(EntityDto input) { await _contatoRepository.DeleteAsync(input.Id); }

Declaration of _contatoRepository is:

private readonly IRepository<Cad_DepositoContato, long> _contatoRepository;

And my class Cad_DepositoContato is:

public class Cad_DepositoContato : FullAuditedEntity

    public long DepositoContatoId { get; set; }
    public virtual string Nome { get; set; }
    public virtual int CodDDI { get; set; }
    public virtual int CodDDD { get; set; }
    public virtual string Fone { get; set; }
    public virtual string Email { get; set; }
    public bool FlgAtivo { get; set; }
    public bool FlgResponsavel { get; set; }

    [ForeignKey("Id")]
    public virtual Cad_Deposito Cad_Deposito { get; set; }
    [Column("OrganizationUnitId")]
    public virtual long Id { get; set; }</span>

3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Did you solve your problem ?

    Thanks.

  • User Avatar
    0
    inovatech created

    Yes, I solved the problem. It was my mistake. Tks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks :)