GetStoredProcedurePrefix() public method

public GetStoredProcedurePrefix ( ) : string
return string
コード例 #1
0
 public string GetParentStoredProcedureName(Table table, ModelRoot model, string moduleSuffix)
 {
     if (table.ParentTable == null) return "";
     else return model.GetStoredProcedurePrefix() + "_" + table.ParentTable.PascalName + "_" + moduleSuffix + "Insert";
 }
コード例 #2
0
            public static string GetBody(Table table, ModelRoot model)
            {
                if (table.Immutable) return string.Empty;
                var sb = new StringBuilder();
                sb.AppendLine("DELETE FROM");
                sb.AppendLine("	[" + table.GetSQLSchema() + "].[" + Globals.GetTableDatabaseName(model, table) + "] ");
                sb.AppendLine("WHERE ");
				sb.AppendLine("	" + BuildDeleteWhereStatement(table, model) + ";");
                sb.AppendLine();
                sb.AppendLine("if (@@RowCount = 0) return;");
                sb.AppendLine();

                if (table.ParentTable != null)
                {
                    var moduleName = (string.IsNullOrEmpty(model.ModuleName) ? string.Empty : "_" + model.ModuleName);
                    sb.Append("exec [" + table.ParentTable.GetSQLSchema() + "].[" + model.GetStoredProcedurePrefix() + "_" + table.ParentTable.PascalName + moduleName + "_Delete]");

                    var pkIndex = 0;
                    foreach (var column in table.PrimaryKeyColumns.OrderBy(x => x.Name))
                    {
                        sb.Append(" @Original_" + column.ToDatabaseCodeIdentifier() + " = @Original_" + column.ToDatabaseCodeIdentifier());
                        pkIndex++;
                        if (pkIndex < table.PrimaryKeyColumns.Count)
                            sb.Append(",");
                    }
                }
                sb.AppendLine();
                return sb.ToString();

            }
コード例 #3
0
 private string GetStoredProcedureName(Table table, ModelRoot model, string moduleSuffix)
 {
     return model.GetStoredProcedurePrefix() + "_" + table.PascalName + "_" + moduleSuffix + "Insert";
 }