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?
- Open the model in the VS entity designer.
- Switch to the Model Browser window.
- Expand the following nodes:
- ModelName.edmx
- Model
- Entity Types
- Complex Types
- Associations
- EntityContainer: MyEntities
- Entity Sets
- In the "Entity Sets" list you should see an entry for "Files". Click it.
- 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" />
精彩评论