Re: UseAsDataSource StackOverflow Error

31 views
Skip to first unread message
Message has been deleted

Jimmy Bogard

unread,
Jun 21, 2016, 2:24:04 PM6/21/16
to automapper-users
Can you put this in GitHub? Looks like a bug.

On Tue, Jun 21, 2016 at 12:50 PM, <nicholas.b...@gmail.com> wrote:

This is giving me a stackoverflow error, but only when I have a collection navigation property.

 

return dbSet.UseAsDataSource(mapper).For<TDTO>().AsExpandable().Where(filter).ToList();

 
Possible filter values that this happens with: 
filter = {f => (True AndAlso Invoke(f => (True AndAlso Invoke(Param_0 => Convert(Param_0.Cust.CustomerNumber).ToString().Contains("123"), f)), f))}

filter = {f => (True AndAlso Invoke(f => ((((False OrElse Invoke(Param_0 => Convert(Param_0.Name1).ToString().Contains("som"), f)) OrElse Invoke(Param_0 => Convert(Param_0.Name2).ToString().Contains("som"), f)) OrElse Invoke(Param_0 => Convert(Param_0.PaytoName1).ToString().Contains("som"), f)) OrElse Invoke(Param_0 => Convert(Param_0.PaytoName2).ToString().Contains("som"), f)), f))}


Right now my mappings are just:

cfg.CreateMap<Cust, CustDTO>().ReverseMap();
cfg.CreateMap<Customer, CustomerDTO>().ReverseMap();

 

Previously I could get away with this because I didn't need the collection.

But now I have added another entity, which requires me to have that collection available in Cust. This Customers property in Cust is just an example of what is causing it.

 
Here are the relevant properties in the entities:
 public class Cust : IEntity   {
 
       
[Key]
       
public int CustomerID { get; set; }
 
       
[Column("Customer")]
       
[MaxLength(20)]
       
public string CustomerNumber { get; set; }
 
       
public bool Status { get; set; }
 
       
public virtual ICollection<Customer> Customers { get; set; }
       
}

 
public class Customer : IEntity
   
{
       
[Key]
       
public int Id { get; set; }
 
       
[ForeignKey("Cust")]
       
public int CustomerId { get; set; }
 
       
public virtual Cust Cust { get; set; }
 
       
public bool Status { get; set; }
 

}


Does anyone know what I am doing wrong? I can't tell if its the expression, automapper, or if my mappings might not be set up the way they need to be.

--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automapper-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nicholas Brown

unread,
Jun 21, 2016, 3:39:19 PM6/21/16
to AutoMapper-users
go ahead and delete this i tried but i guess that didnt work :P sry
Reply all
Reply to author
Forward
0 new messages