Question

I'm trying to create simple tool for concatenating SQL scripts using CodeSmith.

I have template which is generally just:

  • header (check whether tables exists, begin transaction)
  • body (concatenated scripts should be placed here)
  • footer (commit or rollback transaction)

Scripts are stored in separate .sql files. I need to pick these files through CodeSmith Explorer during template generation, but I don't know which UITypeEditor to choose.

I've tried FileNameEditor, but it allows to choose only one file.

Is there any existing UITypeEditor for this purpose? Or do I need to create such by myself?

Was it helpful?

Solution

If you wish to pick a fie then the FileNameEditor is your best choice. If you wish to choose multiple files I'd create my own. If you have to parse the sql files then I'd recommend just selecting a base folder using a UITypeEditor and then using DirectoryInfo to get a list of files matching a pattern in that directory.

If you are looking to concat the output of various templates this can be done via a Generator Project File (See project options -> Single File) out of the box or you could update your master template to accomplish this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top