private Template loadTemplateBy(TemplateDatabaseType templateDatabaseType, string templateName, string templateType, DAS connection) { try { addTemplateNameParameter(templateName, connection); var sqlQuery = string.Format("SELECT t.{2} FROM {3} t WHERE t.{0} = '{4}' AND t.{1}={5}", TemplateTable.Columns.TEMPLATE_TYPE, TemplateTable.Columns.NAME, TemplateTable.Columns.DESCRIPTION, TemplateTable.NAME, templateType, _pName); var row = connection.ExecuteQueryForSingleRow(sqlQuery); return(new Template { DatabaseType = templateDatabaseType, TemplateType = EnumHelper.ParseValue <TemplateType>(templateType), Name = templateName, Description = row.StringAt(TemplateTable.Columns.DESCRIPTION) }); } finally { removeNameParameter(connection); } }