Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make generated code classes file private #46000

Merged
merged 1 commit into from
Jan 10, 2023

Conversation

captainsafia
Copy link
Member

Follow-up to #45924.

This updates the code generated by the RequestDelegateGenerator so that all classes emitted are file private except for:

  • The SourceKey class which is currently used in tests to ensure that endpoints were successfully generated at compile-time.
  • The GenerateRouteBuilderEndpoints which needs to be accessible in order to have the endpoints it contains participate in overload resolution.

@halter73
Copy link
Member

  • The GenerateRouteBuilderEndpoints which needs to be accessible in order to have the endpoints it contains participate in overload resolution.

Can we add the source generated IEndpointRouteBuilder extension methods to the same "file" as the caller so we can make those file-local too?

@captainsafia
Copy link
Member Author

Can we add the source generated IEndpointRouteBuilder extension methods to the same "file" as the caller so we can make those file-local too?

The caller in this case is the user's code so it isn't possible. For example, if the user's MapAction call is this:

app.MapGet("/hello", (int id) => $"Id: {id}");

Then the generated endpoint that needs to be accessible for resolution is:

MapGet(string pattern, Func<int, string> handler)

@captainsafia captainsafia merged commit 3a1c02e into main Jan 10, 2023
@captainsafia captainsafia deleted the safia/update-minapigen-emit branch January 10, 2023 20:28
@ghost ghost added this to the 8.0-preview1 milestone Jan 10, 2023
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants