I was working on a large enterprise application that had a dynamically generated data model, so all data access was done through strings. So much of the code looked like dictionary accesses
Now unfortunately there was not just one constants file, this application numbered nearly 60 projects and each one possessed a constants file and people added strings when they needed to access a new item from the data model.
public class Constants {
string FrontLeftWheel = "FrontLeftWheel;
}
I was given the painful task of replacing every single constant and string in the code with new constants generated from the data model. This probably involved making something along the lines of 40,000 replacements. Luckily I remembered a post by Eric Lippert on Roslyn. Roslyn helped me replace all of the old constants with constants generated from the new data model based on a few heuristics to order by best matches but Roslyn saved me months of mind numbing work so I'ma HUGE fan.
Do you think you could write a blog post about this? Finding interesting uses for Roslyn may help drive its use in the community. Plus, that just sounds interesting.
"if(car[Constants.Wheels"].ContainsKey[Constants.FrontLeftWheel])"
Now unfortunately there was not just one constants file, this application numbered nearly 60 projects and each one possessed a constants file and people added strings when they needed to access a new item from the data model.
public class Constants { string FrontLeftWheel = "FrontLeftWheel; }
I was given the painful task of replacing every single constant and string in the code with new constants generated from the data model. This probably involved making something along the lines of 40,000 replacements. Luckily I remembered a post by Eric Lippert on Roslyn. Roslyn helped me replace all of the old constants with constants generated from the new data model based on a few heuristics to order by best matches but Roslyn saved me months of mind numbing work so I'ma HUGE fan.