views:

46

answers:

1

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  A: 
  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.
Craig Stuntz
Thanks, that did the trick. Now I'm getting different error: "Inconsistent accessibility: property type 'System.Data.Objects.DataClasses.EntityCollection<BLL.File>' is less accessible than property 'BLL.Proje.tblFiles'". I've checked ModelName.edmx > ModelName.Store > Tables/Views > tblFiles but it doesn't have any accessibility property. I edited the designer code manually but it did revert back to public so I assume there is a more appropriate way?
Armagan
That's a C# error, not an EDMX error. What is `BLL.Proje.tblFiles`?
Craig Stuntz
Proje is another Entity. File entity is associated to Proje with a navigation property named "tblFiles". Turned out I had to change the access property of the tblFiles navigation property on the Proje table and it works now. Thanks a lot.
Armagan