Skip to content

Instantly share code, notes, and snippets.

@derekgates
Last active December 15, 2015 19:39
Show Gist options
  • Save derekgates/5313170 to your computer and use it in GitHub Desktop.
Save derekgates/5313170 to your computer and use it in GitHub Desktop.
Replace non-disposed SQLiteCommands to wrapped commands in using statements (covers .ExecuteNonQuery)
^[^\S\r\n]*[^using](?<sql>new SQLiteCommand\((.*), (.*)\))\.ExecuteNonQuery\(\);
replace with:
using (var c = ${sql})\nc.ExecuteNonQuery();
Finding any SQLiteCommand that is wrapped in a using statement:
^.*[^using](?<sql>new SQLiteCommand\((.*), (.*)\))\.(.*)\(\);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment