I\'d like my Entity Framework model to generate entities with internal
access modifier, instead of public
. I use
I wanted my entity container as well as the generated complex classes to be internal. First I set the "Entity Container Access" to internal. Next I added a container variable to the top of the "Model.tt" file after the initialization of the itemCollection variable. I found the container variable code in the "Model.Context.tt" file.
var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
var container = itemCollection.OfType().FirstOrDefault();
Next I changed
<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
to
<#=Accessibility.ForType(container)#> partial class <#=code.Escape(complex)#>
I chose to modify the code in this way so that I could keep my complex class container access modifiers in sync with the container access modifier.
Thank you Gert Arnold for leading me in the right direction.