private static void writeUpdateRowsMethod( DBConnection cn, string tableName, string revisionHistorySuffix, string additionalLogicSuffix, bool includeIsLongRunningParameter) { // header CodeGenerationStatics.AddSummaryDocComment( writer, "Updates rows in the " + tableName + " table that match the specified conditions with the specified data."); writeDocCommentsForColumnParams(columns.DataColumns); CodeGenerationStatics.AddParamDocComment(writer, "requiredCondition", "A condition."); // This prevents Resharper warnings. CodeGenerationStatics.AddParamDocComment(writer, "additionalConditions", "Additional conditions."); // This prevents Resharper warnings. writer.Write("public static void UpdateRows" + revisionHistorySuffix + additionalLogicSuffix + "( "); writeColumnParameterDeclarations(columns.DataColumns); if (columns.DataColumns.Any()) { writer.Write(", "); } writer.WriteLine( "{0} ) {{".FormatWith( StringTools.ConcatenateWithDelimiter( ", ", includeIsLongRunningParameter ? "bool isLongRunning" : "", getConditionParameterDeclarations(cn, tableName)))); // body writer.WriteLine("var mod = CreateForUpdate" + revisionHistorySuffix + "( requiredCondition, additionalConditions );"); writeColumnValueAssignmentsFromParameters(columns.DataColumns, "mod"); writer.WriteLine( "mod.Execute{0}( isLongRunning: {1} );".FormatWith(additionalLogicSuffix, includeIsLongRunningParameter ? "isLongRunning" : "false")); writer.WriteLine("}"); }
private static void writeDocCommentsForColumnParams(IEnumerable <Column> columns) { foreach (var column in columns) { CodeGenerationStatics.AddParamDocComment(writer, column.CamelCasedName, getComment(column)); } }
private static void writeConstructorDocComments(TextWriter writer, List <VariableSpecification> requiredParameters) { foreach (var parameter in requiredParameters) { var warning = ""; if (parameter.IsString || parameter.IsEnumerable) { warning = " Do not pass null."; } CodeGenerationStatics.AddParamDocComment(writer, parameter.Name, parameter.Comment + warning); } }
private static void writeConstructorDocComments(TextWriter writer, IReadOnlyCollection <WebItemParameter> requiredParameters) { foreach (var parameter in requiredParameters) { var warning = ""; if (parameter.IsString || parameter.IsEnumerable) { warning = " Do not pass null."; } var description = parameter.Comment + warning; if (description.Length == 0) { continue; } CodeGenerationStatics.AddParamDocComment(writer, parameter.Name, description); } }
private static void writeUpdateRowsMethod(DBConnection cn, Table table, string revisionHistorySuffix, string additionalLogicSuffix) { // header CodeGenerationStatics.AddSummaryDocComment(writer, "Updates rows in the " + table.ObjectIdentifier + " table that match the specified conditions with the specified data."); writeDocCommentsForColumnParams(columns.DataColumns); CodeGenerationStatics.AddParamDocComment(writer, "requiredCondition", "A condition."); // This prevents Resharper warnings. CodeGenerationStatics.AddParamDocComment(writer, "additionalConditions", "Additional conditions."); // This prevents Resharper warnings. writer.Write("public static void UpdateRows" + revisionHistorySuffix + additionalLogicSuffix + "( "); writeColumnParameterDeclarations(columns.DataColumns); if (columns.DataColumns.Any()) { writer.Write(", "); } writer.WriteLine("" + getConditionParameterDeclarations(cn, table) + " ) {"); // body writer.WriteLine("var mod = CreateForUpdate" + revisionHistorySuffix + "( requiredCondition, additionalConditions );"); writeColumnValueAssignmentsFromParameters(columns.DataColumns, "mod"); writer.WriteLine("mod.Execute" + additionalLogicSuffix + "();"); writer.WriteLine("}"); }