NSQLFormatter is a light-weight .NET-library for beautifying your SQL. NSQLFormatter is an open-source project, written with C# and .NET Framework 4.0. It is based 100% on the work done in the NHibernate-project.
1. Add reference to NSQLFormatter.dll.
2. var formattedSQL = NSQLFormatter.Formatter.Format(originalSQL);
No external references required.
NSQLFormatter is available through the NuGet with the package name NSQLFormatter. Type “install-package NSQLFormatter” to install it.
Source code and the compiled binary is available from the following GitHub-repository: https://github.com/mikoskinen/NSQLFormatter-dotnet
NSQLFormatter was created when a project needed a way to easily beautify the inputted SQL. The excellent NHibernate-project (http://nhforge.org) contained the necessary code but adding the reference to NHibernate's dlls was deemed a too heavy-weight solution. So, the source code in question was copied from the NHibernate and all the requirements for external references (IESI Collections) were removed.
NSQLFormatter is distributed under the terms of the FSF Lesser GNU Public License.
The project includes source code from the NHibernate-project, written by Fabio Maulo, Mike Doerfler, Sergej Košcejev, Ayende Rahien and others. Visit the NHibernate SVN-repository for more information: http://nhibernate.svn.sourceforge.net/viewvc/nhibernate/trunk/nhibernate/src/NHibernate/