Base solution for your next web application

Activities of "kumaran"

ok i found the customdtomapper.cs and i changed the following line in my code to use maxdepth(1)

configuration.CreateMap<CreateOrEditOrderDto, Order.Order>().ForMember(x => x.CreatorUserId, opt => opt.Ignore()).MaxDepth(1);

I still have stackoverflow issue on the same line as i mentioned earlier. What am i missing?

It is not self referencing DTO. The child table is referencing the parent table. Please look at my class model above.

my model design is basically same as "convention 4" mentioned in this link http://www.entityframeworktutorial.net/code-first/configure-one-to-many-relationship-in-code-first.aspx

the problem is, the dto that has to match exactly as class design otherwise i am getting "AutoMapperMappingException" How can i avoid reference in dto object alone?

here is the dto and the class model for example In the following dto, i removed the order reference and get the error.

public class OrderDetail : Entity&lt;int&gt;
{
    [ForeignKey("OrderId")]
    public virtual Events.Order.Order Order { get; set; }
    public virtual int OrderId { get; set; }
    [Required]
    public virtual int ShowTicketId { get; set; }

    public virtual string TicketName { get; set; }
    public virtual int TicketCount { get; set; }
    public virtual double TotalTicketAmount { get; set; }


}

public class CreateOrEditOrderDetailDto : Entity<int> { [Required] public int OrderId { get; set; }

    [Required]
    public int ShowTicketId { get; set; }

    public string TicketName { get; set; }
    public int TicketCount { get; set; }
    public double TotalTicketAmount { get; set; }
}

I will give a try. thanks

Nope. i get the following error if the dto is different than the class.

AutoMapper.AutoMapperMappingException: Error mapping types.

Mapping types: CreateOrEditOrderDto -> Order Events.Order.Dtos.CreateOrEditOrderDto -> Events.Order.Order

Type Map configuration: CreateOrEditOrderDto -> Order Events.Order.Dtos.CreateOrEditOrderDto -> Events.Order.Order

Property: OrderDetails ---> AutoMapper.AutoMapperConfigurationException: Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters ========================================================================= CreateOrEditOrderDetailDto -> OrderDetail (Destination member list) Events.Order.Dtos.CreateOrEditOrderDetailDto -> Events.Order.OrderDetail (Destination member list)

Unmapped properties: Order

at AutoMapper.ConfigurationValidator.AssertConfigurationIsValid(IEnumerable`1 typeMaps) at lambda_method(Closure , CreateOrEditOrderDto , Order , ResolutionContext ) --- End of inner exception stack trace --- at lambda_method(Closure , CreateOrEditOrderDto , Order , ResolutionContext ) at lambda_method(Closure , Object , Object , ResolutionContext ) at AutoMapper.Mapper.AutoMapper.IMapper.Map[TDestination](Object source) at Events.Order.OrdersAppService.Create(CreateOrEditOrderDto input) in C:\Kumaran\AspnetZero\Events\aspnet-core\src\Events.Application\Order\OrdersAppService.cs:line 352 at Events.Order.OrdersAppService.CreateOrEdit(CreateOrEditOrderDto input) in C:\Kumaran\AspnetZero\Events\aspnet-core\src\Events.Application\Order\OrdersAppService.cs:line 341 at Events.MultiTenancy.Payments.PaymentAppService.CreateShowPayment(ShowPaymentInfoInput input) in C:\Kumaran\AspnetZero\Events\aspnet-core\src\Events.Application\MultiTenancy\Payments\PaymentAppService.cs:line 148 at lambda_method(Closure , Object ) at Mic...

found the fix. I have to ignore those attributes in CustomDtoMapper.cs that are not required to be mapped. In my case the order object in the order child tables needs to be ignored otherwise you get into recursive relationship.

       configuration.CreateMap&lt;CreateOrEditOrderDetailDto, OrderDetail&gt;().ForMember(x => x.Order, opt => opt.Ignore());
       configuration.CreateMap&lt;CreateOrEditRewardDto, Reward.Reward&gt;().ForMember(x => x.Order, opt => opt.Ignore());
       configuration.CreateMap&lt;CreateOrEditOrderPromotionDto, OrderPromotion&gt;().ForMember(x => x.Order, opt => opt.Ignore());

I have a similar issue just like gowthamv. what is the solution for this. I do not find any error in the audit logs.

I am using Angular and .net core. I am trying to add a new controller Get method in proj.Web.Core project.

In this method i need to access my logged in current user id so it is a secured method.

When the UI calls this url i get the following Request URL: http://localhost:22742/Profile/GetMyTicketImage?orderId=8011 Request Method: GET Status Code: 302 Found

and then redirects to

Request URL: http://localhost:22742/Account/Login?ReturnUrl=%2FProfile%2FGetMyTicketImage%3ForderId%3D8011 Request Method: GET Status Code: 404 Not Found

What i am missing when i am adding a new controller method?

If it is an anonymous method, it its of no use as i dont get my current user id. I have seen another controller method when you post the profile picture in profile controller which access the current user id and that one works but not mine.

Can anyone help?

Showing 31 to 40 of 47 entries