Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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

"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.



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.


In response to the two replies.

Sure I'll write up a blog post this weekend with the high level details and link to it here when I'm finished.


Interesting... Was suspecting (hoping) that the technology would provide solutions outside ide/code space.

Could you provide some highlevel details of the implementation? TIA!




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: