Create dynamic map from data stored in a database #2328
Unanswered
Danny-Toecutter
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a SQL table that has the following columns: CsvColumnName | PropertyName | DataType
and the following data:
CatalogueTypeCode|CatalogueTypeCode|String
CatalogueType|CatalogueTypeCode|String
Catalogue|CatalogueTypeCode|String
TypeCode|CatalogueTypeCode|String
DayInPeriod|DayInPeriod|String
EventID|EventId|String
Event|EventId|String
Eve|EventId|String
EveId|EventId|String
MeanLoss|MeanLossAmount|Decimal
Perspvalue|MeanLossAmount|Decimal
Loss|MeanLossAmount|Decimal
RegionalPeril|PerilZone|String
PerilZone|PerilZone|String
Region|PerilZone|String
Period|Period|String
PeriodId|Period|String
Year|Period|String
I want to retrieve this data back and create a map on the fly.
So if it was hard coded, it would look something like this:
Map(m => m.EventId).Name("EventId", "Event", "Eve", "EveId");
Map(m => m.Period).Name("Period", "PeriodId", "Year");
Map(m => m.MeanLossAmount).Name("MeanLoss", "Perspvalue", "Loss");
Map(m => m.DayInPeriod).Name("DayInPeriod");
Map(m => m.PerilZone).Name("RegionalPeril", "PerilZone", "Region");
Map(m => m.CatalogueTypeCode).Name("CatalogueTypeCode", "CatalogueType", "Catalogue", "TypeCode");
I'm trying to do it dynamically because if the users start using a new column header in their CSV files, I would prefer to add it to the database rather than have to recompile and redeploy.
Any suggestions or help is greatly appreciated..
Beta Was this translation helpful? Give feedback.
All reactions