为什么的EntityFramework追加1默认在EDMX数据库实体后? [英] Why does EntityFramework append a 1 by default in edmx after the database entities?

查看:170
本文介绍了为什么的EntityFramework追加1默认在EDMX数据库实体后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么的EntityFramework 添加 1 在默认情况下新创建的EDMX文件?说我有一个名为数据库的 EmployeesDB ,选择添加>新建ADO.Net数据实体数据模型,然后在向导中选择该数据库中创建多个文件,

Why does EntityFramework add a 1 by default to a newly created EDMX file?. Say I have a database called EmployeesDB , choosing Add > New ADO.Net Data Entity data model and choosing this database in the wizard creates multiple files,

包括 EmployeeDB.Designer.cs ,在那里我们有

 public partial class SchoolDBEntities1 : ObjectContext

这是为什么 1 在这里需要的?它只是感觉就像那些快速和肮脏的code段的一个名称像这样从目前来看,并给它一个合适的名字后面的东西......但我敢肯定,必须有一个很好的理由

Why is this 1 needed here? It just feels like one of those quick-and-dirty code snippets "Name it like this for now, and give it a proper name latter things"... But I'm sure there must be a good reason for this

推荐答案

EF使用数字来解析名称冲突。你已经有另外一个类中指定的项目 SchoolDBEntities ?也许一个老EDMX文件?还是手写的东西?或者,也许一类意味着作为部分扩展到 SchoolDBEntities 但其中部分关键字失踪了?

EF uses numbers to resolve name conflicts. Do you already have another class in the project named SchoolDBEntities? Maybe an old EDMX file? Or something handwritten? Or maybe a class meant as a partial extension to the SchoolDBEntities but where the partial keyword is missing?

如果您删除冲突类,你可以重命名新生成并删除 1 在EDMX设计。

If you remove the conflicting class, you can rename the newly generated and remove the 1 in the EDMX designer.

这篇关于为什么的EntityFramework追加1默认在EDMX数据库实体后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆