更改实体可访问性 [英] Changing Entity accessibility

查看:133
本文介绍了更改实体可访问性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让一个实体内部。我将实体,其标量属性和导航属性更改为内部。当我尝试构建它时,我收到此错误:



错误6036:EntityType'File'具有'Internal'可访问性,EntitySet'Files'获得具有公共可访问性的财产。 EntitySet的get属性不能比包含EntityType的访问更少的限制性访问。



由于此错误,我无法编辑designer.cs,因此不会生成。我检查了edmx文件,但没有任何与文件或文件相关联的公共值。我应该怎么做?

解决方案


  1. 在VS实体设计器中打开模型。
  2. 切换到模型浏览器窗口。

  3. 展开以下节点:





  • ModelName.edmx


    • 模型


      • 实体类型

      • 复杂类型

      • 关联

      • EntityContainer:MyEntities


        • 实体集








  1. 实体集列表,您应该看到文件的条目。点击它。

  2. 切换到属性编辑器窗口并更改Getter的可见性。


I want to make an entity internal. I've changed entity, its scalar properties and navigation properties to internal. I'm getting this error when I try to build it:

Error 6036: EntityType 'File' has 'Internal' accessibility and EntitySet 'Files' has a get property with 'Public' accessibility. EntitySet's get property must not have less restrictive access than containing EntityType's access.

I can't edit designer.cs because of this error it isn't generated. I've checked edmx file but there aren't any public values associated to "File" or "Files". What should I do?

解决方案

  1. Open the model in the VS entity designer.
  2. Switch to the Model Browser window.
  3. Expand the following nodes:

  • ModelName.edmx
    • Model
      • Entity Types
      • Complex Types
      • Associations
      • EntityContainer: MyEntities
        • Entity Sets

  1. In the "Entity Sets" list you should see an entry for "Files". Click it.
  2. Switch to the property editor window and change the Getter visibility.

这篇关于更改实体可访问性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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