Inconsistent accessibility error when passing UserQuery to methods in a loaded script
Another [problem in my quest to use a custom datacontext. I have a script using a database connection based on a custom TypedDataContext
. Queries in the script work fine but I am also using #load
to load a second script containing extension methods. The loaded script uses the same connection as the one loading it. The extension methods have a UserQuery context
parameter and I use this
to pass the UserQuery when calling these methods. But I'm getting the error "CS0051 Inconsistent accessibility: parameter type 'UserQuery' is less accessible than method 'FavoritingExtensions.Favorite(Flickr, string, UserQuery)". This does not happen if I allow LINQPad to generate the TypedDataContext for a connection and use that. How can I correct this error?
Comments
The UserQuery is made internal in this case to allow for the custom Typed data context to be declared as internal. I guess it would be better if LINQPad inspected the actual type and matched its accessibility, but this could be some work to implement.
Does it help if you define that method as internal rather than public?
I'll try that, though it's an extension method so may need to be public.
Making the static classes and methods in the script being loaded internal solved the problem.