PDA

View Full Version : Named parameters


DavidTatum
06-25-2007, 03:49 PM
Is there an easy way to use named parameters in a MapRow method? Instead of :

customer.FirstName = dataReader.GetString(0);
customer.LastName = dataReader.GetString(1);

I'd like to do something like:

customer.FirstName = something.GetString("firstname");
customer.LastName = something.GetString("lastname");

I was hoping this is what MappingAdoQueryWithContext was for, but I can't find any examples.

Bruno Baia
06-25-2007, 04:38 PM
Hi,

sure, this is pure ADO.NET :

customer.FirstName = reader.GetString(reader.GetOrdinal("firstname"));
customer.LastName = reader.GetString(reader.GetOrdinal("lastname"));



HTH,
Bruno

DavidTatum
06-25-2007, 08:28 PM
Thanks. My .net is not very good. ;-)