[英]C# Entity Framework database first symbol in column name
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 SQL Server数据库有一列名为
FORM#
的列,但是当它导入到C#文件中时,它变成
public string FORM_ { get; set; }
so I'm getting an error where it says that FORM_
does not exist 所以我得到一个错误,它说
FORM_
不存在
I've tried using 我试过使用
[Column("FORM#")]
from System.ComponentModel.DataAnnotations.Schema
. 从
System.ComponentModel.DataAnnotations.Schema
。
Is there any way to bypass this without making changes to the database name? 有什么方法可以绕过此操作而无需更改数据库名称?
See if this works instead of Column("FORM#") 查看它是否代替Column(“ FORM#”)是否有效
DisplayName("FORM#")
public string FORM_ { get; set; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.