Complex mapping

Dec 31, 2010 at 8:33 AM

I have complex mapping between database and client app and I need to pass mapping info to value injector.

1. Database field name does not match filed name of the client object (kgh ->PersonName).

2. Most database fields are encrypted.

3. Database field type does not match field type of the client object (varchar -> decimal, varchar -> date, varchar - enum ...)

I have created an interface IEntityMap that contains all mapping information between db and client.

My question is how to pass IEntityMap to the value injector?

 

Coordinator
Dec 31, 2010 at 12:33 PM

it could be something like:

IEntityMap theMap = get it from somewhere

a.InjectFrom(new MyInjection(theMap), b);

 

any value injection is a class so play with it as you want, constructors, properties, fluent interface whatever

and you can pass instances of valueinjections during the injection,

if you do a.InjectFrom<MyInjection> the ValueInjecter is going to create an instance for you (if it has a parameter-less constructor)

Good luck, and

A Happy New Year !!!

 

Dec 31, 2010 at 3:21 PM

Thank you for your fast response and for help.

I'll give it a try.

Happy new year.