I have an MVC model in which most of the field names are single-letter strings because my client's desired column headers are sentences of up to about 15 words in length. In the database, I kept the field names small so I could add calculated fields (the data is all small integer values). I kind of carried the one and two letter field names over from Excel to SQL Server, as Excel was the original 'database'.
As you can see below, I've added the DataAnnotations namespace and am using the Display directive to change the field names displayed in the MVC views, exactly as I have seen done in training videos. I'm showing two fields below, but actually, there are many such fields, as well as many such tables. Unlike in the training video where everything always works perfectly, the single-letter field names following 'Display(' are each giving me an error that says "The best overload for 'DisplayAttribute' does not have a parameter named 'G'". It says 'H' for the second one and so on.
What is causing this error? How can I get this error, marked on each field name after 'Display(', to go away? I have 21 different tables like this. I hope I don't have to revamp the entire database with super long field names. Thanks for your help.
What I have tried:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
namespace MyProject.Models
{
[MetadataType(typeof(hraInMetaData))]
public partial class hraIn
{
}
public class hraInMetaData
{
[Display(G: "Long Field Name 1")]
public Nullable<byte> G { get; set; }
[Display(H: "Long Field Name 2")]
public Nullable<byte> H { get; set; }
.
.
.
.