コード例 #1
0
        /// <summary>Saves the generated code to a file and returns the updated result.</summary>
        /// <param name="result">Result to update.</param>
        /// <param name="structFile">Name of the file to write to (optional).</param>
        /// <returns>Returns an updated result instance.</returns>
        public static GenerateTableCodeResult SaveStructFile(this GenerateTableCodeResult result, string structFile = null)
        {
            if (result.FileName == null)
            {
                if (structFile == null)
                {
                    result.FileName = result.ClassName + ".cs";
                }
                else
                {
                    result.FileName = structFile;
                }
            }

            File.WriteAllText(result.FileName, result.Code);
            return(result);
        }
コード例 #2
0
 /// <summary>Adds a table to the code.</summary>
 /// <param name="tableCodeResult">The table to add.</param>
 /// <param name="getterName">Name of the getter in the resulting class (optional).</param>
 public void Add(GenerateTableCodeResult tableCodeResult, string getterName = null)
 {
     Add(className: tableCodeResult.ClassName, tableName: tableCodeResult.TableName, getterName: getterName);
 }