English 中文(简体)
LINQ 实体数据模型产生代码错误——“DBContexts”类型。 类别已经包含“ID”的定义
原标题:LINQ entity data model generated code error - The type DBContexts.Category already contains a definition for ID

我的数据库有两张表格——类别和部门,都包含同样的栏目——ID、名称和法典。

我可以使用2008年视觉演播室设计师创建新的实体模式,并加添该部,并做精细的工作——我可以使用LINQ查询数据库。

当我更新模型并增加类别表格时,产生的代码在我尝试和汇编时留下以下错误。

The type  DBContexts.Category  already contains a definition for  ID 
The type  DBContexts.Category  already contains a definition for  _ID 

The type  DBContexts.Category  already contains a definition for  Name 
The type  DBContexts.Category  already contains a definition for  _Name 

A partial method may not have multiple defining declarations

我猜测这一点与以下事实有关:该部和职类的栏目名称相同,但与《守则》栏有问题。

我如何解决这一问题的想法? 如果我更新这一模式,那么,任何变化都会消除,那么我实际上不会听从产生的法典。

卡车

最佳回答

当你更新了dbml档案时,如果无法查阅该档案,则设计人.cs档案也重新生成,并添加到该项目中。 由于这两个档案中的班级都是部分的,但是在编辑上具有相同的财产和田地,你会发现这一错误。

如果你只拥有一个设计者为你的环境而制作的档案,你可以检查。 你们可以通过正确点击贵阶层的名称和选择“定义”来做到这一点,它将显示所有载有贵阶层定义的档案。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签