开发者

Changing Entity accessibility

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 an开发者_运维问答y 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.


I was unable to find the "EntityContainer: MyEntities" in the Model Browser. I'm still not sure why -- my entity designer and model browser are fully functional otherwise, except for this. So, I was able to change the Getter visibility directly through XML. Just open .edmx file using XML editor and add the GetterAccess attribute similar to this in the "CSDL content" section.

<EntitySet Name="Locations" EntityType="MyComponent.Location" a:GetterAccess="Internal" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜