C# Entity Framework database first symbol in column name

c# entity-framework-6 mapping sql-server

Question

I'm working on a project with a database that has been around for a long time and people aren't too keen on changing anything in it (probably so they won't have to fix their other applications).

The SQL Server database has a column named FORM# but when it gets imported into the C# file, it turns into

public string FORM_ { get; set; }

so I'm getting an error where it says that FORM_ does not exist

I've tried using

[Column("FORM#")]

from System.ComponentModel.DataAnnotations.Schema.

Is there any way to bypass this without making changes to the database name?

1
0
9/11/2018 4:31:18 PM

Popular Answer

See if this works instead of Column("FORM#")

DisplayName("FORM#")    
public string FORM_ { get; set; }
0
9/25/2018 7:08:11 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow