locked
generic design RRS feed

  • Question

  • Hello,
    At present I have written a generic C# code which basically takes the content of any file and then populates the destination table of that file in the database...
    Some of these files have fields with text values which refer to key values in the Dimension tables. So for example, File1 has a column "column5" which may have a value of 'Brazil'. The code should know that it has to refer to the country Dimension table to get the code of Brazil i.e. BRZ and then use this value to populate it into the destination table rather than the text Brazil. And so forth for other examples in other files that may refer to other dimension tables...
    There may be up to 10 dimension tables for all the files and this may increase in future.

    Question:
    How do you design this system GENERICALLY so that the destination tables are populated with the dimension key values rather than just the complete text in file?

    Thank you

    Monday, October 10, 2016 10:42 PM

Answers

  • It sounds like you have a dynamic mapping between .CSV file columns and DB columns?
    My first advice to doing any bulk inserts in a DB is: Do not do that in C# code. Do it in the DBMS/SQL. It can do it faster and more reliable then your code ever could. And it of course supports reading in .CSV files.

    If we are supposed to help you, we would need some more details. In particular a mapping file/csv file/target DB example.


    Remember to mark helpfull answers as helpfull and close threads by marking answers.

    Tuesday, October 11, 2016 5:00 PM

All replies

  • Hi arkiboys,

    Thank you for posting here.

    For your question, may be you missed something. Such as you want to find a file on your computer, you could do it with your file path. Similarly, you want to find 'Brazil' in your example. You need do the following.

    Files> File1> Tables> Table1> Columns> Column5> Brazil

    And then put this value to populate it into the destination table which you want.

    I hope this would be helpful to you.

    If you have something else, please feel free to contact us.

    Best Regards,

    Wendy


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 11, 2016 12:27 PM
  • It sounds like you have a dynamic mapping between .CSV file columns and DB columns?
    My first advice to doing any bulk inserts in a DB is: Do not do that in C# code. Do it in the DBMS/SQL. It can do it faster and more reliable then your code ever could. And it of course supports reading in .CSV files.

    If we are supposed to help you, we would need some more details. In particular a mapping file/csv file/target DB example.


    Remember to mark helpfull answers as helpfull and close threads by marking answers.

    Tuesday, October 11, 2016 5:00 PM