VB.Net Issue / Examples

Jan 12, 2015 at 8:40 AM
Hi,

I'm using FluentData on an older Vb.Net website and I'm having problems creating a custom mapper using this C# example:

List<Product> products = Context.Sql(@"select * from Product")
        .QueryMany<Product>(Custom_mapper_using_datareader);
public void Custom_mapper_using_datareader(Product product, IDataReader row)
{
product.ProductId = row.GetInt32("ProductId");
product.Name = row.GetString("Name");
}

The problem is around the signature for the "Public Sub" that would replace "Custom_mapper_using_datareader" and I am not sure how to define it.

Any help appreciated.
Developer
Feb 14, 2015 at 11:47 AM
I don't confirm it's a problem,and it's new year for Chinese.

If you no mind,I can try fix it after 2 month later.

and may you can try use Custom mapping using dynamic.
Nov 10, 2016 at 1:25 AM
@gcyoung2015

If you (or anyone else, I suppose) are still trying to figure this out, here's the VB.NET equivalent:
.QueryMany(Of Product)(AddressOf Custom_mapper_using_datareader)
with
public Sub Custom_mapper_using_datareader(product as Product, row as IDataReader)

product.ProductId = row.GetInt32("ProductId");
product.Name = row.GetString("Name");

End Sub 
The key is the AddressOf modifier in the QueryMany argument. You can see an example of this on the MSDN - not exactly straight-forward if (like me) you mostly live in the C# world.