Show / Hide Table of Contents

File Overwrite Protection

To avoid the Code Generators overwriting any code that has been written manually. Whenever the code generator creates some code, its also creates a checksum and places this in the file. The next time the file is to be overwritten the checksum is checked. If the checksum is valid then the file is overwritten, otherwise no changes are made.

The checksum is not white space sensitive.

Usage

In the first or last line of the file insert the Keyword "ALLOWOVERWRITE". Generally this should be placed within a comment, so it won't effect the compiling of the code.

When the code is generated the Code Generator will calculate a checksum and append to the end of the ALLOWOVERWRITE keyword. e.g. ALLOWOVERWRITE-72348F4F04114DC556AB75B28C355587

If you have made changes to a file but still wish the code generator to overwrite it, just remove the "-" and the checksum from the end of the ALLOWOVERWRITE keyword. e.g. Change ALLOWOVERWRITE-72348F4F04114DC556AB75B28C355587 to ALLOWOVERWRITE to allow the file to be over written.

Example: Razor File with ALLOWOVERWRITE Keyword

@using SilverDawn.SilverModel.UML.Extensions;
@using SilverDawn.SilverModel.UML.Interfaces.Classes;
@using SilverDawn.SilverModel.UML.Classes;
// ALLOWOVERWRITE

using System;
using System.Collections.Generic;
using System.Linq;

Eample: Output of Razor File with ALLOWOVERWRITE Keyword

// ALLOWOVERWRITE-72348F4F04114DC556AB75B28C355587

using System;
using System.Collections.Generic;
using System.Linq;
Back to top Generated by DocFX