变化的实体访问 [英] Changing Entity accessibility

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

问题描述

我想打一个实体的内部。我已经改变了的实体,它的简单属性和导航属性的内部。当我尝试构建它,我得到这个错误:

错误6036:的EntityType'文件'有'内部'可及性和EntitySet的'文件'与'公共'访问一个获取属性。的EntitySet的get属性必须不能比含有的EntityType的访问限制较少的访问。

这个错误,因为它不产生我不能编辑designer.cs。我检查EDMX文件,但目前还没有相关的文件或文件任何公共价值。我该怎么办?

解决方案
  1. 打开模式,在VS实体设计。
  2. 切换到模型浏览器窗口。
  3. 展开以下节点:
  
      
  • ModelName.edmx   
        
    • 型号   
          
      • 在实体类型
      •   
      • 复杂类型
      •   
      • 协会
      •   
      • EntityContainer相关:MyEntities   
            
        • 在实体集
        •   
      •   
    •   
  •   
  1. 在实体集列表中,您应该看到文件的条目。点击它。
  2. 切换到属性编辑器窗口,并改变吸气的知名度。

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天全站免登陆