Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internal classes with ADO.NET Entity Framework

I'm using Entity Framework for creation of my Data Access Layer and I want for all of my classes to be internal.

I know it is possible to manually assign it in the designer for each class.

UPDATE I found that my initial statement

But looks like it also requires to set internal modifier for each single property in every class! I have about 30+ entities and it will be a huge work to do.

was incorrect. I was missing that when I set access on Entity Type I need to set an appropriate access on Entity Set as well.

Do you know any ideas how to set a 'default access' for the entire model?

like image 248
Regent Avatar asked Nov 15 '22 11:11

Regent


1 Answers

Actually if your class is internal, it doesn't matter if the properties are public - the class itself isn't visible outside your project, so the properties can never be accessed (unless through reflection)

like image 186
Steffen Avatar answered Dec 11 '22 20:12

Steffen