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

Open access to public properties in MinimalAPIs #551

Closed
zhenlei520 opened this issue Apr 13, 2023 · 1 comment
Closed

Open access to public properties in MinimalAPIs #551

zhenlei520 opened this issue Apr 13, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@zhenlei520
Copy link
Contributor

Description

The effect is as follows:

public class UserService : ServiceBase
{
    public string Ping => "success";
}

Generate API address:

https://localhost: XXX/api/v1/Users/Ping

@zhenlei520 zhenlei520 added the enhancement New feature or request label Apr 13, 2023
@zhenlei520 zhenlei520 self-assigned this Apr 13, 2023
@zhenlei520
Copy link
Contributor Author

zhenlei520 commented Apr 13, 2023

Only public access to public properties is open. To avoid misunderstandings, this configuration is disabled by default. Can be enabled by configuration

  • global configuration
var builder = WebApplication.CreateBuilder(args);

var app = builder.AddServices(options =>
{
    options.EnableProperty = true;
});
  • local configuration
public class UserService : ServiceBase
{
    public UserService()
    {
        RouteOptions.EnableProperty = true;
    }

    public string Ping => "success";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants