Replacer
The Replacer node type will help you replace the content of a file on disk.
(1) This node has been set to the "Replacer" node type.
These are the parameters you can pass:
(2) file - This is the file's name whose contents need to be replaced. This should not be hard coded, rather, it should be written in a way that will make it to be constructed from Expanders. For example:
A string like this: [%EF_SCAFFOLD_FOLDER%]\[%DB_CONTEXT%].cs
can expand into C:\codestencil\generated\ef-scaffold-folder\MyProjectContext.cs
(3) replacementText - This is the text you will use to replace the targetText. It can also consist of expanders, e.g.
{ [%CARRIAGE_RETURN%] public [%DB_CONTEXT%]() {} [%CARRIAGE_RETURN%]
Which may expand into something like this:
public MyProjectContext() { }
(4) targetText - This is the text you want to replace/overwrite. In this case, we want to replace the first "{"
(5) targetTextStringCheck—The replacer algorithm will check if this string exists. If so, it aborts the replace function. This may be needed in cases where the string has already been replaced in a prior cycle, and running the replacer again may mess up the source/target file. Most of the time, this string will be exactly the same string used for the replacement text.
When combined, it may look like this:
[%EF_SCAFFOLD_FOLDER%]\[%DB_CONTEXT%].cs
replacementText=
[%REPLACEMENT_TEXT%]
targetText=
{
targetTextStringCheck=
[%DB_CONTEXT%]()
Check here for complete help on the Node Form.