I am creating some experimental OR/M library using all the "standard" patterns: UnitOfWork, IdentiryMap etc. I have created a skeleton and some functionality almost for all of the components, only DataMapper has left. My goal is to avoid reflection completely, I would like to rely only on AOP(PostSharp) and code generation.
So the question is: I have two methods in each Mapper class: MapToEntity and MapToDb.
My intention is to avoid some metadata mapping because then I'll have to use reflection to set properties. Instead I think - I can use some (hypothetical) generator to generate those MapToEntity and MapToDb methods. But I am a bit in doubt - will it still be "mapping" if I use the code like this:
MapToEntity(Customer c, DbDataReader reader)
{
// here goes the trivial code
c.someValue = SomeConverterUtility.ToSomething(reader['someColumn']);
.....
return c;
}
And also this mapper contains some generated SQL queries for CRUD.
Can this implementation be considered a valid and good Mapper (like in M.Fowler's articles)? Can it be implemented better (but again - avoiding reflection)?