VS 2k5 autogenerated code gem
A coworker found this in code generated by Visual Studio 2005:
this.sqlSelectCommand2.CommandText = "SELECT columnName1, columnName2, columnName3, columnN" +
"ame4, columnName5, columnName6 FROM MyViewFromMa" +
"nyTables"
Searching for MyViewFromManyTables is beautifull...
Refactor that!!
Legacy Comments
Jon
2006-11-27 |
re: VS 2k5 autogenerated code gem Another good reason to use the Command object and execute a stored procedure :). |
Miha Markic
2006-11-28 |
re: VS 2k5 autogenerated code gem Autogenerated code isn't there for refactoring beacuse - it is autogenerated. If you want to have a strong typed database access then you need another approach. Jon: both approaches do use command object and both can use a stored procedure. I agree though that VS designers aren't suitable for larger applications (I tend to avoid them except when I have to create a quick sample). |
Mladen
2006-11-28 |
re: VS 2k5 autogenerated code gem well if i change the views name in sql server i can use SQL refactor to rename/refactor the whole db it and it's great. and when i want to change it in code it's really fun to find :)) but i agree with you Miha. |
Jon
2006-11-28 |
re: VS 2k5 autogenerated code gem Miha my point was your procedure name will not be (hopefully) the length of that SQL string. You avoid all the SELECT blah1, blah2 FROM...+... etc. |
Miha Markic
2006-11-28 |
re: VS 2k5 autogenerated code gem Mladen: Yes, IMO those designers are not meant to work on larger projects. Jon: I see. :-) |