Dictionary to Business Object newbie

Aug 10, 2012 at 1:36 AM
Edited Aug 10, 2012 at 1:42 AM

Hi,

I am VERY new to Value Injecter please so forgive my newbie questions.

I am needing to perform a series of imports from CSV files into separate tables in my WinForms application. To that end, I have written a method that grabs the values from each line in the CSV file and placed them in a Dictionary along side the appropriate field name in the database table.

I have a Dictionary(String, String) that contains the field name of my Business Object (BO) and the field name from the import CSV file. For example:

Table Field Name, CSV Field Name

ID, Code

Description, Desc

SerialNum, SerialNo

 

I tried code like this:

injecter.Inject(StockItem, stockDictionary);

I received no errors, but the StockItem BO is not populated. I assume this is because  stockDictionary does not contain every field in the BO.

Is my thinking correct?

If so, how do I deal with the missing fields in the CSV?

If not, can you please explain where I am misunderstanding things?

Furthermore, the CSV data is all of type String. Will Value Injecter automatically convert  to the appropriate database data types?

Due to my newbie status, I would appreciate some code examples to explain how to complete these tasks properly.

Thank you.

Coordinator
Aug 10, 2012 at 7:34 PM

please try doing these samples first:

http://valueinjecter.codeplex.com/wikipage?title=step%20by%20step%20explanation&referringTitle=Documentation

also after this try looking through the demos, there is WinForms demos as well