简体   繁体   English

C#Entity Framework数据库列名称中的第一个符号

[英]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.

相关问题 C#实体框架-无效的列名 - C# Entity Framework - Invalid column name 实体框架数据库首先,相同的表和列名称映射 - Entity Framework database first, same table and column name mapping 实体框架-首先从数据库“无效的列名'discriminator''开始编码 - Entity Framework - Code first from database “invalid column name 'discriminator'” 具有类/数据库的循环引用(C#,首先是实体框架代码) - Circular reference with Classes/Database (C#, Entity Framework Code First) 首先使用C#实体框架数据库-仅使用某些字段 - C# Entity Framework Database First - use only some fields C#实体框架6上下文对象数据库首先具有现有DbConnection - C# Entity Framework 6 Context Object Database First with existing DbConnection 如何在不将第一个实体插入Entity Framework C#中的数据库的情况下将实体ID分配给另一个实体? - How to assign entity Id to another entity without inserting first entity into database in Entity Framework, C#? c#实体框架“无法解析符号” - c# Entity Framework “Cannot resolve symbol” 首先从实体框架6数据库中的数据库中获取列名,并在映射中使用不同的属性名称 - Get the column name from the database in entity framework 6 database first with different property name in mapping 实体框架代码第一列名称问题 - Entity Framework Code First column name issue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM