BindingListView
BindingListView copied to clipboard
ambiguous match found exception in bindinglistview
https://stackoverflow.com/questions/32313458/ambiguous-match-found-exception-in-bindinglistview
question from link:
I keep getting this exception while using Andrew Davey's BindingListView (http://blw.sourceforge.net/). I am using ServiceStack OrmLite . My objects looks like this:
public class Category
{
public int Id { get; set; }
public string Name { get; set; }
}
public class Product
{
public int Id { get; set; }
public int CategoryId { get; set; }
public int ProductTypeId { get; set; }
public string Name { get; set; }
[Reference]
public Category Category { get; set; }
}
I have no idea how to pass this exception.
i think this is happening because
product.Name product.Category.Name
product.Id
product.Category.Id
when that lib does reflection to get Property, it gets 2 "Name".
code doesnt know, Which one do you want. Product.Name from or Product.Category.Name.
my proposed solution is blw shoud ignore properties if it is customClass (Category which is inside of Product)
public class Product
{
public int Id { get; set; }
public int CategoryId { get; set; }
public int ProductTypeId { get; set; }
public string Name { get; set; }
/* blw should not read the properties of this customClasses */
public Category Category { get; set; }
}
Hi @blackholeearth Sorry, I don't maintain this code anymore and I haven't used it in years. Feel free to make a fork and fix it up - I'll be glad to put a link in this repo's README to point to yours.