Overview
Squirt is a code generation tool originally targeted at the CODE Framework and C#, but does not require the use of the CODE Framework. You can see a short demo video here http://screencast.com/t/uyUwfey2.

Squirt is not intended to be a replacement for knowing what you’re doing! Its only goal is to help developers create routine source code more quickly.

Use
Once Squirt is installed, you can right click on any C# project, choose Add… and select Squirt at the bottom of the menu. You’ll be prompted for the “root name” of the thing you want to build. For example Customer, Invoice, Product, etc. It should be singular and begin with a capital letter.

On the left hand side of the screen, you can type in properties by hand or retrieve them from a table in a database (SQL Server only for now).

Squirt will search through your solution, find projects matching the templates and show you a list of each file it can generate on the right hand side of the screen. Project types are determined by the ending of the project name. The default templates are geared toward use with the CODE Framework and include templates for project names that end in .Contracts, .Wpf and .Mvc.

When you click the Generate button, each file will be created, opened and formatted (assuming the “Format Document” command in Visual Studio is available for the type of document being generated).

Notes:
1. Squirt was built and tested in VS 2013
2. You may have to add some project references manually - Squirt just generates text
3. Squirt templates and the settings file are located in the root folder for the solution
4. You can edit the setting file and templates from within or outside of Squirt. They are just plain text files
5. Changes to the settings file made within Squirt do not yet take effect until Squirt is restarted, but changes to templates take effect immediately
6. The following text replacement codes are available for use in templates:
- a. $classname$
- b. $filename$
- c. $initializeproperties$ (to C# default values)
- d. $initializequickproperties$ (just those checked as quick properties)
- e. $namespace$
- f. $namespacewithoutsubfolder$ (for files in special subfolders such as those within Models or Views folders)
- g. $primarykeyname$
- h. $primarykeytype$ (C# primitive type)
- I. $projectname$
- j. $propertydefinitions$ (see below for an explanation of how these are templated as well)
- k. $propertydefinitions2$ (in case you need more than one way to template them)
- l. $propertyquickdefinitions$
- m. $propertyquickdefinitions2$
- n. $rootname$ (the name you entered when you started)
- o. $servicename$ (root name of the wcf service to be created – e.g. ‘Customer’)
7. $propertydefintions$, $propertydefinitions2$, $propertyquickdefinitions$ and $propertyquickdefinitions2$ are generated from their own templates prior to the file generation template being run. These property template files must have exactly the same name as the main template except that they must end in .Properties.template (or .Properties2.template) instead of just .template

Known Issues:
1. If you create a project and subsequently move the project into or out of a Solution Folder, Squirt will not function properly and will add the contents of a single xml to your solution instead. This is not an issue with Squirt it is a known issue with Visual Studio Extensibility. Details can be found here. Workarounds include:
- a. Running Squirt from a C# project that has not been moved into or out of a project folder (the _ExternalComponents project for example)
- b. Creating a dummy C# project just to trigger Squirt
- c. Moving the project back into (or out of) the solution folder to its original location
2. Currently Squirt can only connect to SQL Server databases. Support for other databases will be added in future releases.

Upcoming Features
1. Support for MySql and Oracle databases
2. Ability to retrieve a list of properties from an existing code file (in addition to manual creation and reading from an existing database)
3. Ability to download default templates via internet
4. We're open to suggestions!

Last edited Jan 6, 2015 at 7:05 PM by MikeYeager, version 3